Honor Push
This topic describes the three main steps for connecting to 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
Add the Push > HONOR component. This process is the same as adding the push SDK. For more information, see Add the push SDK.
NoteThe 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.
Prepare a development environment that meets the integration requirements for Honor Push. For more information, see Development preparation - Environment context.
Configure the configuration file. Download the
mcs-services.jsonconfiguration file from the Honor Developer Service Platform. For more information, see Add the Application Configuration File.Configure the SDK repository address. For more information, see Configure the SDK's Maven repository address.
Add the dependency configuration. In the application-level
build.gradlefile, 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.
To use obfuscation, add the required obfuscation configuration:
For all connection types, you must add the Honor Push obfuscation script.
If you are using the AAR connection type, you also need to add obfuscation rules.
Test Honor Push
Honor Magic OS versions earlier than 8.0 continue to use the Huawei Push adaptation layer.
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.
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
Verify that the Honor configuration and parameters match the Honor Push backend. Ensure that the required configuration is added to
AndroidManifest.xmland thatcom.hihonor.push.app_idmatches the value in the Honor Push backend.
Check that the
mcs-services.jsonfile exists and is in the correct location.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.
Check the logcat logs to troubleshoot the issue:
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.CreatorSelect 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.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: xxxxThis log indicates that reporting the vendor token failed. Verify that
base64Codehas 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.