Meizu channel integration

Last updated: 2020-11-16 15:20:37

    ## Operation Scenarios
    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 application.

    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.
    • The Meizu channel supports arrival callback and click callback but not passthrough.

    Directions

    Getting key

    Enter Meizu Push's official website, sign up for a developer account and log in, and get the AppID, AppKey, and AppSecret. For more information, please see the Meizu development documentation.

    Integration steps

    Integrating through Android Studio

    implementation 'com.tencent.tpns:meizu:[VERSION]-release'// Meizu Push [VERSION] is the version number of the current SDK, which can be viewed on the SDK download page

    Integrating through Eclipse

    1. Download the SDK installation package.
    2. Open the Other-Push-jar folder and import the jar packages related to Meizu Push. Import mz4tpns1.1.2.1.jar to the project folder:
    3. Configure the following content under 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="application package name.push.permission.MESSAGE" 
                    android:protectionLevel="signature"/>
    <uses-permission android:name="application 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="application package name.permission.C2D_MESSAGE"
                    android:protectionLevel="signature">
    </permission>
    <uses-permission android:name="application package name.permission.C2D_MESSAGE"/>
    <!-- Note: this is the end of permissions required by Meizu Push -->
    1. For the Meizu message receiver, add Receiver in AndroidManifest.xml with the following configuration:
    <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="application package name"></category>
         </intent-filter>
    </receiver>
    1. To manually integrate Meizu mobiles of version Flyme 6.0 or earlier, you need to place a picture named " stat_sys_third_app_notify" under drawable folder with different resolutions. For details, see the flyme-notification-res folder in TPNS Android SDK.

    Enabling Meizu push

    Configure the following code before starting TPNS and calling XGPushManager.registerPush:

    // Set 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:

    // The tokens of TPNS and Meizu are successfully obtained, and the binding is successful, indicating that the registration is successful.
    INFO16:24:27.94313075XINGE[a] >> bind OtherPushToken success ack with [accId = 2100273138 , rsp = 0] token = 08d7ea8e4b93952cbfdd2cb68461342c314d281a otherPushType = meizu otherPushToken = ULY6c5968627059714a475c63517f675b7f655e62627e

    If you need to get parameters through the click callback or redirect to a custom page, you can use the intent to do so. For more information, please see FAQs for Android.

    Code obfuscation

    -dontwarn com.meizu.cloud.pushsdk.**
    -keep class com.meizu.cloud.pushsdk.**{*;}

    Note:

    If the Meizu token is properly registered in the App Debug version, but cannot be obtained in the Release version, check whether the obfuscation rules are added.

    • If you are using Android Studio 3.4 or later versions, this problem may be caused by the enabled R8 obfuscation in Android Studio by default.
      Solution: add android.enableR8 = false to gradle.properties
    • Obfuscation rules must be stored in the proguard-rules.pro file at the application project level.

    Receipt configuration for Meizu channel

    Developers need to manually configure the arrival receipt for Meizu channel. For more information about the configuration, see Receipt Configuration Guide for Meizu Channel. And then ,you can view the arrival data of the Meizu push channel in the push record.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help