In this page:
Table of Contents |
---|
...
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 | ||
---|---|---|
| ||
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(); } } } |
...
Step 5 - Token User Member Match
If various parameters belonging to the user are known, they can be added in the activity as below or during the registration phase. Thanks to the code block below, if the user with the same information is available in the Euromessage RMC panel, the received token will be matched to the user.
...
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.
...
Code Block | ||
---|---|---|
| ||
EuromessageCallback callback = new EuromessageCallback() { @Override public void success() { Toast.makeText(getApplicationContext(), "REGISTER EMAIL SUCCESS", Toast.LENGTH_LONG).show(); } @Override public void fail(String errorMessage) { String message = "REGISTER EMAIL ERROR "; if(errorMessage != null) { message = message + errorMessage; } Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show(); } }; EuroMobileManager.getInstance().registerEmail("test@euromsg.com", EmailPermit.ACTIVE, false, getApplicationContext(), callback); |
Step 7 - Read Report
...
language | java |
---|
...
& Navigating
To capture the content of the incoming push notification, you should use the onNewIntent() method as follows.
If you have previously entered a class through the EuroMobileManager.setPushIntent() method, the onNewIntent() method must be added to that class. If you did not use the setPushIntent() method, the onNewIntent() method must be added to the launcher activity.
If you are using SDK version 4.5.2 and above, read report will be sent from SDK automatically. You just need to navigate.
Code Block |
---|
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if (intent.getExtras() != null) { Message message = (Message) intent.getExtras().getSerializable("message"); String url = handlePush(message, intent); } } @Override protected void onResume() {message.getUrl(); // Navigate to super.onResume(); the corresponding page by using url above. if (getIntent().getExtras() != null && EuroMobileManager.getInstance().getNotification(getIntent()) != null} } |
If you are using an SDK version below 4.5.2, you must also send the read report.
Code Block |
---|
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if EuroMobileManager.getInstance().reportRead(getIntent()(intent.getExtras()); != null) { } } private void handlePush(Message message, Intent intent) {Message message = (Message) intent.getExtras().getSerializable("message"); EuroMobileManager.getInstance().reportRead(intent.getExtras()); String url = EuroMobileManager.getInstance().removeIntentExtra(intent);message.getUrl(); // Navigate to the corresponding page here by using message url above. } } |
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.
...