tencent cloud

Feedback

Meizu Channel Integration

Last updated: 2022-05-11 16:44:13

    Overview

    The Meizu push channel is a system-level push channel officially provided by Meizu. On a Meizu phone, push messages can be delivered through Meizu's system channel without opening the app.

    Note:

    • For the Meizu push channel, the notification title can support up to 32 characters, and the notification content can support up to 100 characters.
    • The Meizu push channel does not support in-app messages.

    Directions

    Obtaining a key

    1. Go to the Meizu Push website to sign up for a developer account and log in. Then, get the values of the AppID, AppKey, and AppSecret. For more information, see Meizu Development Documentation.
    2. Copy the application's AppID, AppKey, and AppSecret and paste them into TPNS console > Configuration Management > Basic Configuration > Meizu Official Push Channel.

    Integration methods

    Integrating through Android Studio

    implementation 'com.tencent.tpns:meizu:[VERSION]-release'// For Meizu pushes, [VERSION] is the version number of the current SDK and can be obtained from the "SDK for Android".
    
    Note:

    For Meizu pushes, [VERSION] is the version number of the current SDK and can be obtained from the SDK for Android.

    Integrating through Eclipse

    1. Download the SDK installation package.

    2. Open the Other-Push-jar folder and import the Meizu Push-related JAR package. Import mz4tpns1.1.2.1.jar to the project folder.

    3. Perform the following configuration under the Android manifest:

      <application>
      <service
                   android:name="com.meizu.cloud.pushsdk.NotificationService"
                   android:exported="true"/>
      <receiver android:name="com.meizu.cloud.pushsdk.SystemReceiver" >
      <intent-filter>
                  <action android:name="com.meizu.cloud.pushservice.action.PUSH_SERVICE_START"/>
                  <category android:name="android.intent.category.DEFAULT" />
      </intent-filter>
      </receiver>
      </application>
      <!-- Note: This is the beginning of permissions required by Meizu Push -->
      <!-- Compatible with Flyme versions below 5.0. Meizu's internal integration pushSDK is required; otherwise, messages cannot be received -->
      <uses-permission android:name="com.meizu.flyme.push.permission.RECEIVE"></uses-permission>
      <permission android:name="app package name.push.permission.MESSAGE" 
                  android:protectionLevel="signature"/>
      <uses-permission android:name="app package name.push.permission.MESSAGE"></uses-permission>
      <!-- Compatible with Flyme 3.0 configuration permissions -->
      <uses-permission android:name="com.meizu.c2dm.permission.RECEIVE" />
      <permission android:name="app package name.permission.C2D_MESSAGE"
                  android:protectionLevel="signature">
      </permission>
      <uses-permission android:name="app package name.permission.C2D_MESSAGE"/>
      <!-- Note: this is the end of permissions required by Meizu Push -->
      
    4. Add the following receiver configuration in AndroidManifest.xml:

      <receiver android:name="com.tencent.android.mzpush.MZPushMessageReceiver">
      <intent-filter>
          <!-- Receive push message -->
          <action android:name="com.meizu.flyme.push.intent.MESSAGE" />
          <!-- Receive register message -->
           <action android:name="com.meizu.flyme.push.intent.REGISTER.FEEDBACK"/>
          <!-- Receive unregister message -->
           <action android:name="com.meizu.flyme.push.intent.UNREGISTER.FEEDBACK"/>
           <action android:name="com.meizu.c2dm.intent.REGISTRATION" />
           <action android:name="com.meizu.c2dm.intent.RECEIVE" />
           <category android:name="app package name"></category>
       </intent-filter>
      </receiver>
      
    5. Manual integration is needed for Meizu phones running Flyme 6.0 or earlier. To do so, you need to place an image named exactly stat_sys_third_app_notify to the drawable folders for each resolution. For more information, please download TPNS Android SDK and refer to the flyme-notification-res folder in Other-Push-jar > meizu.

    Enabling Meizu push

    Configure the following code before you start TPNS and call XGPushManager.registerPush:

    // Set the Meizu AppId and AppKey.
    XGPushConfig.enableOtherPush(context, true);
    XGPushConfig.setMzPushAppId(this, APP_ID);
    XGPushConfig.setMzPushAppKey(this, APP_KEY);
    

    The log of successful registration is as follows:

    // If the TPNS token and Meizu token are successfully obtained and bound, the registration is successful.
    I/TPush: [OtherPushClient] handleUpdateToken other push token is : V5R5b7c02********47744c6b635e464b527e487802 other push type: meizu
    I/TPush: [PushServiceBroadcastHandler] >> bind OtherPushToken success ack with [accId = 150000****  , rsp = 0]  token = 0398291156ce7d2f****66bd0952c87c372f otherPushType = meizu otherPushToken = V5R5b7c02********47744c6b635e464b527e487802
    

    If you want to obtain parameters or redirect to custom pages via click callback, you can use Intent to implement it. For more information, please see Android FAQs.

    Code obfuscation

    1. Add the following obfuscation rules in the proguard-rules.pro file at the application project level.
      -dontwarn com.meizu.cloud.pushsdk.**
      -keep class com.meizu.cloud.pushsdk.**{*;}
      
      
    Note:

    If a debug version of an application can register a Meizu token normally, but the release version cannot, upgrade the SDK to v1.3.2.0 or later.

    1. If the application uses the plug-in AndResGuard, add the following in the configuration allowlist of AndResGuard. Skip this step if AndResGuard is not used.
      whiteList = [
      "R.drawable.stat_sys_third_app_notify"
      ]
      

    Configuring Arrival Receipt for Meizu channel

    The arrival receipt for the Meizu channel should be configured by yourself. After configuring this feature as instructed in Acquisition of Vendor Channel Arrival Receipt, you can view the arrival data for the Meizu push channel in the push records.

    Troubleshooting

    Querying Meizu Push registration error codes

    If you observe logs similar to the following, it indicates that registration with the Meizu channel fails. In that case, you can use the method described as below to get the Meizu PUSH registration error code.

    [OtherPushClient] handleUpdateToken other push token is :  other push type: mezu
    

    In debugging mode of the push service, filter logs by the keyword OtherPush to view the return code logs, for example, [OtherPush_XG_MZ] onRegisterStatus BasicPushStatus{code='110000', message='Invalid appId'}. Then locate the error cause and rectify the error by referring to Troubleshooting Vendor Channel Registration Failures.

    Why do I receive the client/server error code 500 when I push messages through the Meizu channel?

    The arrival receipt for the Meizu channel is incorrectly configured. You can configure it by referring to Receipt Configuration Guide for the Meizu Channel.

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support