Honor Push

Updated at:

This topic describes the three main steps for connecting to Honor Push.

  1. Register for Honor Push

  2. Connect to Honor Push

  3. Test Honor Push

Register for Honor Push

Log in to the official Honor developer website, create an account, and enable the push service. For more information, see Steps to enable Honor Push.

Connect to Honor Push

  1. Add the Push > HONOR component. This process is the same as adding the push SDK. For more information, see Add the push SDK.

    Note

    The Push > HONOR component contains only the adaptation code and does not include the Honor Push SDK. You must add the Honor Push SDK dependency separately.

  2. Prepare a development environment that meets the integration requirements for Honor Push. For more information, see Development preparation - Environment context.

  3. Configure the configuration file. Download the mcs-services.json configuration file from the Honor Developer Service Platform. For more information, see Add the Application Configuration File.

  4. Configure the SDK repository address. For more information, see Configure the SDK's Maven repository address.

  5. Add the dependency configuration. In the application-level build.gradle file, add the following compile dependency to the `dependencies` block.

    dependencies {
        // Add the following configuration
        implementation 'com.hihonor.mcs:push:7.0.61.302'
    }
    • For more information, see Add dependency configuration.

    • To update the version, see Version information.

    • The current mPaaS version is compatible with version 7.0.61.302. You can change the version if you need a later one. Vendor SDKs are usually backward compatible.

  6. To use obfuscation, add the required obfuscation configuration:

Test Honor Push

Important

Honor Magic OS versions earlier than 8.0 continue to use the Huawei Push adaptation layer.

  1. After connecting to Honor Push, start the application on an Honor phone and make sure the initialization method is called. For more information, see Getting Started. The push SDK obtains the vendor token for Honor Push and reports it.

  2. Push a test message after you stop the application process:

    • If you receive the message, your application is successfully connected to Honor Push.

    • If you do not receive the message, follow the steps below to troubleshoot the issue.

Troubleshoot issues

  1. Verify that the Honor configuration and parameters match the Honor Push backend. Ensure that the required configuration is added to AndroidManifest.xml and that com.hihonor.push.app_id matches the value in the Honor Push backend.

  1. Check that the mcs-services.json file exists and is in the correct location.

  2. Verify that the Honor channel is enabled in the mPaaS console. For more information, see Configure the Honor push channel. Also, ensure that the related configuration matches the Honor Push backend.

  3. Check the logcat logs to troubleshoot the issue:

    1. Select the push process, filter for mPush.PushProxyFactory, and check for the following log entry:

      D/mPush.PushProxyFactory: found proxy com.mpaas.push.external.honor.Creator
    2. Select the main process, filter for `mHonor`, and check if the vendor token for Honor Push was obtained. If the log shows get token failed, it indicates that obtaining the Honor vendor token failed. For a list of error codes, see Honor Push error codes.

    3. Select the main process, filter for report channel token, and check if the Honor vendor token was reported successfully. If the following log appears:

      report channel token error: xxxx

      This log indicates that reporting the vendor token failed. Verify that base64Code has a value as described in Step 3. Add the configuration file to the project. Also, check that the APK signature uploaded when you obtained the configuration file matches the signature of the current application.

      If not, an issue may have occurred when adding the Push > HONOR component. Confirm that the component was added correctly.

Other issues

Which models and system versions does push support?

The Honor vendor push channel supports Honor phones that run Magic OS 8.0 or later. Versions earlier than Magic OS 8.0 continue to use the Huawei vendor push channel.