Huawei Push

Require at least React-Native Batch Plugin v6.0.

This guide assumes that you have already integrated the Batch SDK into your app as Batch's HMS plug-in isn't standalone.

Note: Expo isn't supported. Please use standard React Native, or eject to the bare workflow.

As Batch's HMS plug-in works automatically without having to call any native code yourself, there is no Batch react-native plugin to install. Installing the dependencies is beginner-friendly, but some knowledge of Android's toolchain (especially Gradle) is helpful.

However, you will need to:

  • Setup the react-native HMS push plugin
  • Add Batch's HMS native dependency

Integration

Setup React Native Huawei Plugin

First, setup the HMS's react-native push plugin by following Integrating React Native Push Plugin.

If you have already set it up, please check you have at least the version 5.0.1.300 and that you are not using @hmscore/react-native-hwpush. Otherwise, please migrate to @hmscore/react-native-hms-push.

Then, to be fully working with the Batch's plugin, you need to remove the HmsPushMessageService from your android manifest :

<!-- Add this line to add the tools namespace -->
<manifest [...]
          xmlns:tools="http://schemas.android.com/tools">
    [...]
    <application>
        [...]
        <!-- Add this line to remove the default HmsPushMessageService -->
        <service
            android:name="com.huawei.hms.rn.push.remote.HmsPushMessageService"
            tools:node="remove" />
    </application>
</manifest>

Setup Batch's HMS Plugin

  • Now, you can add the Batch's HMS plugin native dependency in android/app/build.gradle.
implementation 'com.batch.android:hms-plugin:1.1.0'

And that's it, congratulations on finishing the bulk of the integration!

If you have any difficulties or need more information, please visit the native documentation.