Configure Mi Push Channel

Last Updated on : 2023-09-15 09:11:03download

This topic describes how to request the App ID and configure the Mi Push service on the Mi Dev Platform to implement Xiaomi push notifications for your Tuya-enabled OEM app.

Prerequisites

A Xiaomi developer account is registered on the Mi Dev Platform.

Step 1: Request App ID

  1. Log in to the Mi Dev Console and choose Distribute.

    To proceed with this step, identity verification is required. We recommend that you register the developer account as an organization that is used to apply for software copyright.

  2. Click Create Application to create an app.

  3. Enter the following basic information:

    • Default language: Select English.

    • App Name: Enter an app name.

    • Package name: Enter a package name.

      The app name and package name must be the same as those configured for your OEM app on the Tuya IoT Development Platform.
      Configure Mi Push Channel

  4. Confirm the settings and click Create.

  5. After the app is created, you can get and save the following information about the app:

    • App ID

    • App Key

    • App Secret

      Configure Mi Push Channel
  6. Return to the Tuya IoT Development Platform, go to App > Required Setting > Certificate for Android, and then enter the values of App ID, App Key, and App Secret that you have obtained in the previous step.

    Configure Mi Push Channel

Step 2: Launch app

Launch your OEM app on Xiaomi GetApps. This is required before Mi Push can be enabled for your app.

Step 3: Enable Mi Push

  1. Log in to the Mi Dev Console > All apps.

  2. Find the newly-created app, and click Enable push in the Operation column.

    Configure Mi Push Channel
  3. Configure app information

    1. Choose Mi Dev Console >App info > Channel and click Create.

    2. For example, if the Android package name of your app is com.example.app, enter the following content:

      In the following table, the content of the message scenario and message example are provided for your reference only. Replace them with your own content.

      Notification type Description Message category Custom ringtone Message scenario Message example
      Doorbell call notification Notifications from devices like doorbells Device information android.resource://com.example.app/raw/doorbell Doorbell call notification []Device notification
      You have a notification from the device. Device status: {your device status}.
      Alert notification Notifications of device alerts and alarms Device information android.resource://com.tuya.smartiot/raw/thing_warnbell Notification of device fault []Device fault
      A fault has occurred on your device XXX.
      Notification by short ringtone Notification of changes in device information like device status Device information android.resource://com.example.app/raw/shortbell Notification of changes in device information like device status []Device notification
      You have a notification from the device. Device status: {your device status}.
      Notification by long ringtone Notification of changes in device information like device status Device information android.resource://com.example.app/raw/longbell Notification of changes in device information like device status []Device notification
      You have a notification from the device. Device status: {your device status}.
      Generic notification Notification of changes in account and home information Account information android.resource://com.example.app/raw/shortbell Changes in account and home information []Home notification
      You have joined the XX home.
  4. After the channel is created, wait for Xiaomi’s review. After your app passes the review, a notification category ID is generated.

  5. Send your app name, Android package name, notification category IDs, and notification names to Tuya’s email push@tuya.com. Then, Tuya will configure Xiaomi push notifications for your app within one to two working days.