Huawei SDK Setup

Requirements

  1. Huawei Developer Account
  2. Java JDK installation package
  3. Android SDK package
  4. Android Studio 3.X
  5. HMS Core (APK) 4.X or later
  6. Huawei Device or Huawei Cloud Debugging

Supports Android API level 4.4 or higher.

Information

Huawei AdID service requires min target SDK version 19

D·engage Huawei SDK provides an interface which handles push notification messages that delivered by Huawei Messaging Service (HMS). It is similar to Firebase but has a bit different configuration process that contains the following steps;

1. Preparations for HMS Core

Before you start, prepare your android project for HMS Push. Please follow the steps on docs that written by Huawei;

https://developer.huawei.com/consumer/en/codelab/HMSPreparation/index.html#6

2. Implementation Huawei Push Kit

The following docs will help you to configure your android project and Huawei App Connect account for implementing Push Kit;

https://developer.huawei.com/consumer/en/codelab/HMSPushKit/index.html#4

3. Implementation OAID

D·engage SDK tries to access device AdID which is provided by Huawei, to associate with a subscription. To do that you need to add the following dependency to your android project.

dependencies { 
	implementation 'com.huawei.hms:ads-identifier::x.y.z'  
}

For more information please read the documentation:
https://developer.huawei.com/consumer/en/codelab/HMSAdsOAID/index.html#3

4. Creating Push Application

4.1 Visit your project settings page on Huawei App Gallery Connect and navigate to App Information Section. Copy your AppID and AppSecret.

Creating Dengage Push Application Step 1

4.2 Login your D·engage Admin Panel. Navigate to “Settings > Push Applications” page and click the “Add > Android (Huawei)” button. Paste your AppID and AppSecret into associated box.

Creating Dengage Push Application Step 2

4.3 Save your application and keep your integration key for the next steps.

5. App Configuration

If you prefer to handle messages (delivered from D·engage) by the SDK , you will need to apply these steps;

5.1 Add the following dependencies to build.gradle file which is located in your project root directory and sync.

buildscript {  
    repositories {  
        ...    
    }  
    dependencies {  
		...
  }  
}  
  
allprojects {  
    repositories {   
        ...
         maven { url 'https://jitpack.io' } // add this line
    }  
} 

5.2 Add the following dependencies to build.gradle file which is located in your project app directory and sync:

apply plugin: 'com.android.application'
...
dependencies {  
   ... 
  implementation 'com.github.whitehorse-technology:dengage.android.sdk:VERSION' // Add this line and set your prefered version.
  ...
}
...

5.3 Paste the following configuration values into your AndroidManifest.xml file. Thus all incoming push messages that received from D·engage Platform will be generated by the SDK.

<application ...>
...
	<service android:name="com.dengage.sdk.HmsMessagingService">
		<intent-filter>
			<action android:name="com.huawei.push.action.MESSAGING_EVENT" />
		</intent-filter>
	</service>
	<receiver android:name="com.dengage.sdk.NotificationReceiver"
    android:exported="false">
    <intent-filter>
        <action android:name="com.dengage.push.intent.RECEIVE" />
        <action android:name="com.dengage.push.intent.OPEN" />
        <action android:name="com.dengage.push.intent.DELETE" />
    </intent-filter>
</receiver>
...
</application>

After these steps, You will be able to send a push notification to your app and view the notification which is built by the SDK.