In this page:
Table of Contents |
---|
...
Step 1 - Requirements
Android mobile app & Android Studio |
Firebase Cloud Messaging ve Huawei Push Kit - google_services.json & agconnect_services.json |
RMC Account - AppAlias |
Minimum 21 API Level Test Device |
Step 2 - Adding Dependencies
...
2.2 Please add code block to project / build.gradle
Code Block | ||
---|---|---|
| ||
buildscript { repositories { google() jcenter() maven {url 'http://developer.huawei.com/repo/'} } dependencies { classpath "com.android.tools.build:gradle:$gradle_version" classpath 'com.google.gms:google-services:$google_version' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.huawei.agconnect:agcp:$huawei_version' } } allprojects { repositories { google() jcenter() maven {url 'http://developer.huawei.com/repo/'} maven { url 'https://jitpack.io' } } } |
...
Code Block |
---|
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
|
Push notifications are from FCM and HMS will be covered by Euromessage. You may need to define your application's Application Class - if it does not exist. All you have to do here is create a new class, extend it from Application Class and define it in the AndroidManifest file
...
Code Block | ||
---|---|---|
| ||
android:requestLegacyExternalStorage="true" |
...
Step Step 4 - Add other codes
You will see example implementation below. For this you need to define FIREBASE_APP_ALIAS and HUAWEI_APP_ALIAS through the RMC panel.
Code Block | ||
---|---|---|
| ||
public class MainApplication extends Application { private final String FIREBASE_APP_ALIAS = "euromessage-android"; private final String HUAWEI_APP_ALIAS = "euromsg-huawei"; private static EuroMobileManager euroMobileManager; @Override public void onCreate() { super.onCreate(); euroMobileManager = EuroMobileManager.init(FIREBASE_APP_ALIAS, HUAWEI_APP_ALIAS, this); euroMobileManager.registerToFCM(getBaseContext()); } } |
...
Code Block | ||
---|---|---|
| ||
public class MainApplication extends Application {
private final String FIREBASE_APP_ALIAS = "euromessage-android";
private final String HUAWEI_APP_ALIAS = "euromsg-huawei";
private static EuroMobileManager euroMobileManager;
@Override
public void onCreate() {
super.onCreate();
euroMobileManager = EuroMobileManager.init(FIREBASE_APP_ALIAS, HUAWEI_APP_ALIAS, this);
euroMobileManager.registerToFCM(getBaseContext());
setExistingFirebaseTokenToEuroMessage();
if (!EuroMobileManager.checkPlayService(getApplicationContext())) {
setHuaweiTokenToEuromessage();
}
}
} |
4.4 Getting Push Notification Permission(Android 13 or higher)
Validate your SDK versions. Compile and target SDK version should be at least 33.
Code Block | ||
---|---|---|
| ||
android { compileSdkVersion "33" defaultConfig { targetSdkVersion "33" } } |
Use the below Euromessage method to trigger the native prompt to request push notification permission.
Code Block | ||
---|---|---|
| ||
EuroMobileManager.getInstance().requestNotificationPermission(activity); |
Step 5 - Token User Member Match
...
As soon as an application is installed on the mobile device, the token information of this device is written to the RMC database with the push subscription service. A token; “anonymous”, that is, it is recorded without being paired with any user until the user logs in to the application. In order for this token to be paired with a user, it must be logged in the device and an information identifying the owner of this token (KEY_ID or EMAIL) must be sent to the RMC. This information is located in the "extra": {} block in the push message payload.
In order for your data from the mobile channel to be uploaded to RMC, please pay attention that whatever reference value you have used in your active RMC account (KEY_ID * or E-Mail) comes from the mobile channel with this reference.
*KEY_ID: These are the id values used by the application owner to deduplicate the customer. These can be expressed with different names such as CRMid, userid, customerid, accountid.
...