Step 1 - Requirements
...
2.1 Please add code block to app/build.gradle (Module: app)
Code Block | ||
---|---|---|
| ||
dependencies { implementation 'com.euromsg:euromsg:$euromessage_version' } apply plugin: 'com.huawei.agconnect' apply plugin: 'com.google.gms.google-services' |
...
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/'} } } |
...
Don’t forget to click sync.
Step 3 - Adding codes to Android Manifest
...
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 | ||
---|---|---|
| ||
--compulsory parameters-- euroMobileManager.setEmail("melike.yildirim@euromsg.com", this); euroMobileManager.setEuroUserId("123455", this); --optional parameters-- euroMobileManager.setAppVersion("1.1"); euroMobileManager.setFacebook("euroFB", this); euroMobileManager.setTwitterId("euroTW", this); euroMobileManager.setPhoneNumber("05320000000", this); euroMobileManager.setLocation(41.12,29.11); euroMobileManager.setNotificationTransparentSmallIcon(android.R.drawable.your_drawable, getApplicationContext()); euroMobileManager.syncsetNotificationColor(this); |
...
"#d1dbbd");
euroMobileManager.setChannelName("Demo", getApplicationContext());
euroMobileManager.setPushIntent("com.relateddigital.euromessage.MainActivity", getApplicationContext());
euroMobileManager.sync(this);
|
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.
...
Step 7 - Read Report
Code Block | ||
---|---|---|
| ||
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if (intent.getExtras() != null) { Message message = EuroMobileManager.getInstance(Message).reportRead( intent.getExtras().getSerializable("message"); handlePush(message, intent); } } } @Override protected void onResume() { super.onResume(); if (getIntent().getExtras() != null && EuroMobileManager.getInstance().getNotification(getIntent()) != null) { EuroMobileManager.getInstance().reportRead(getIntent().getExtras()); } } private void handlePush(Message message, Intent intent) { EuroMobileManager.getInstance().reportRead(intent.getExtras()); EuroMobileManager.getInstance().removeIntentExtra(intent); // Navigate the corresponding page here by using message } |
Proposal :
If the push notification reaches your device in debug mode when sending campaigns from RMC, but not in release mode, take a look at your problems with pro-guard in your application.
...