Huawei React Native SDK Setup
Follow these instructions if your app is distributed on the Huawei AppGallery.
Requirements
- Android Studio
- A Huawei device with "Huawei App Gallery" installed
- Configured OneSignal App and Platform
Configure your OneSignal app and platform
Required
Before enabling push notifications, make sure your app is set up with the platforms you support— Apple (APNS), Google (FCM), Huawei (HMS), and/or Amazon (ADM). Follow the steps below to configure your OneSignal account and platform settings.
If your team already has a OneSignal account, ask to be invited as an admin role so you can configure the app. Otherwise, sign up for a free account to get started.
Details on configuring your OneSignal app (click to expand)
You can configure multiple platforms (iOS, Android, Huawei, Amazon) within a single OneSignal app.
1. Create or select your app
- Select your app and go to Settings > Push & In-App to add platforms to an existing app.
- Or create a new app by clicking New App/Website.

Example shows creating a new app.
2. Set up and activate a platform
- If creating an app, choose a recognizable app and organization name.
- Select a platform to activate.
- Click Next: Configure Your Platform.

Example setting up your first OneSignal app, org, and channel.
3. Configure platform credentials
Follow the prompts based on your platforms:
- Android: Set up Firebase Credentials
- iOS: p8 Token (Recommended) or p12 Certificate
- Amazon: Generate API Key
- Huawei: Authorize OneSignal
Click Save & Continue after entering your credentials.
4. Choose target SDK
Select your app's target SDK and click Save & Continue.

Select which SDK you are using to be navigated to the docs.
5. Install SDK and save your App ID
You’ll be shown your OneSignal App ID — make sure to save it, as you’ll need it during SDK installation.
If needed, invite a teammate or developer by clicking Invite, then click Done.

Save your App ID for SDK setup and invite any more team members.
Continue through the rest of our documentation to complete the integration.
Setup
1. Setup the OneSignal React Native SDK
Follow the OneSignal React Native SDK setup guide. Firebase / Google setup not required for app builds released to the Huawei AppGallery.
2. Huawei Setup
Configure app information in AppGallery Connect
Add dependencies to React Native android project
In the case ReactNative plugin is going to be used (see step 4), then this step can be skipped.
Under project build.gradle add the following
buildscript {
repositories {
google()
jcenter()
maven { url 'https://developer.huawei.com/repo/' }
}
dependencies {
...
classpath 'com.huawei.agconnect:agcp:1.6.0.300'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://developer.huawei.com/repo/' }
}
}
- Under app build.gradle add the following
apply plugin: "com.android.application"
apply plugin: "com.huawei.agconnect"
...
dependencies {
...
implementation 'com.huawei.hms:push:6.3.0.304'
}
3. React Native Huawei Plugin setup (Optional)
OneSignal does not require the React Native Huawei plugin and in most cases you can omit this. However, if you need specific Huawei features in React Native see Integrating React Native HMS Push Kit Module
When following the plugin setup, after downloading the plugin remove the RNHmsMessageService from the downloaded plugin's AndroidManifest.xml
file under the android package.
4. Huawei Location Service (Optional)
Add implementation 'com.huawei.hms:location:<HUAWEI HMS VERSION #>
to your app build.gradle's dependencies section.
Make sure to also add the location permission to your AndroidManifest.xml if you don't have this already
dependencies {
...
implementation 'com.huawei.hms:location:4.0.0.300'
}
Notes/Resources
This is an example React Native project integrating the Huawei React Native Plugin.
- HMS error code reference to help debug logs and successfully integrate HMS Core SDK with the OneSignal SDK.
Keystore Signature
- Huawei Signing Certificate Usage
- You may need to create a debug or release keystore signature (choose the correct app build path,
debug
orrelease
) so that a6003
error is avoided when registering for HuaweipushToken
with the OneSignal SDK.
- You may need to create a debug or release keystore signature (choose the correct app build path,
Updated about 1 year ago