Huawei Cordova 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
If your team already created an account with OneSignal, ask to be invited as an admin role so you can setup the app. Otherwise, sign up for a free account at onesignal.com to get started!
Details on configuring your OneSignal app (click to expand)
You can setup multiple platforms (iOS, Android, Web, Email, SMS) within the same OneSignal App under Settings > Platforms. If you want to create a new app select New App/Website. If this is your first OneSignal app, you will see the next page.
Name your app and organization something recognizable, then select the platform to setup. You can always set up more platforms in this OneSignal App later within Settings > Platforms.
Click Next: Configure Your Platform.
To configure your app, follow the prompts based on the platforms you support.
- Android: Set up your Android Firebase Credentials
- iOS: p8 Authentication Token or p12 Push Notification Certificate
- Amazon: Generate an Amazon API Key
- Huawei: Authorize OneSignal to send Huawei Push
After you setup your credentials, click Save & Continue.
Choose your Apps Target SDK, the click Save & Continue.
Finally, you will be directed to install the SDK and provided your OneSignal App ID. Make sure to save your App ID as you will need it later.
If you need a teammate or your developer to assist, you can click Invite them to the app and select Done when finished.
Continue through the documentation to finish adding OneSignal to your app.
Setup
1. Setup the OneSignal Cordova SDK
Follow the OneSignal Cordova SDK setup guide. Firebase / Google setup not required for app builds released to the Huawei AppGallery.
2. Huawei Setup
Follow the Huawei Push Kit Cordova Getting Started guide.
When following the Integrating the Plugin setup, after downloading the plugin, change the downloaded plugin's plugin.xml
file to remove the CordovaHMSMessageService from the AndroidManifest.xml
.
3. 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
Notes/Resources
This is an example Cordova project integrating the Huawei Cordova Plugin.
HMS error code reference to help debug logs and successfully integrate HMS Core SDK with the OneSignal SDK.
Updated 6 months ago