Mapp Engage SDK & App Manifest
First, you need to install the Mapp Engage SDK and then update your app manifest.
Step 1: Add the following data to the Android Configuration File
CEP_URL : This is the Jamie URL for caching and delivering In-App Messages.
SDK Key: This is the SDK Key generated from the Mapp Engage Channel Management. There will be a different SDK Key for each app you have configured in your Mapp Engage environment. For example, customers with Android development, Android Production, iOS development, and iOS production apps, will have four different SDK Keys. One for each app. You can also view this in the Mapp Engage system under Administration > Channels.
APP_ID: This is the ID number of your app from the Mapp Engage Channel Management. There will be a different App ID for each app you have configured in your Mapp Engage environment. For example, customers with Android development, Android Production, iOS development, and iOS production apps, will have four different App ID Keys. One for each app. You can also view this in the Mapp Engage system under Administration > Channels.
TENANT_ID: This is the ID number of your Mapp Engage system. A Mapp Cloud account manager or project manager will provide all the info mentioned above to you.
Google Project ID: This is the ID number of your Google Project
class AndroidAdvancedTestApplication : Application() {
override fun onCreate() {
super.onCreate()
...
val opt = AppoxeeOptions()
opt.sdkKey = SDK_KEY
opt.googleProjectId = GOOGLE_PROJECT_ID
//(optional for SDK 6.0.0 and above)
opt.cepURL = CEP_URL
opt.appID = APP_ID
opt.tenantID = TENANT_ID
//Only for version 5.0.10+
opt.notificationMode = NotificationMode.BACKGROUND_AND_FOREGROUND
//for SDK 6.0.0 and above
opt.server = AppoxeeOptions.Server.EMC
Appoxee.engage(this, opt)
//This line is necessary for Android Oreo and above
Appoxee.instance().receiver = MyPushBroadcastReceiver::class.java
//Necessary for applications with locked screen rotation.
Appoxee.setOrientation(this, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
//Registered users are opt-outed by default.
Appoxee.instance().isPushEnabled = true
}
}
public class AndroidAdvancedTestApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
...
AppoxeeOptions opt = new AppoxeeOptions();
opt.sdkKey = SDK_KEY;
opt.googleProjectId = GOOGLE_PROJECT_ID;
//(optional for SDK 6.0.0 and above)
opt.cepURL= CEP_URL;
opt.appID = APP_ID;
opt.tenantID= TENANT_ID;
//Only for version 5.0.10+ (optional)
opt.notificationMode = NotificationMode.BACKGROUND_AND_FOREGROUND;
//for SDK 6.0.0 and above
opt.server = AppoxeeOptions.Server.EMC;
Appoxee.engage(this, opt);
//This line is necessary for Android Oreo.
Appoxee.instance().setReceiver(MyPushBroadcastReceiver.class);
//Necessary for applications with locked screen rotation.
Appoxee.setOrientation(this, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
//Registered users are opt-outed by default.
Appoxee.instance().setPushEnabled(true);
}
}
Step 2: Register MyPushBroadcastReceiver in your app manifest
App Manifest Update
<receiver
android:name=".MyPushBroadcastReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="com.appoxee.PUSH_OPENED" />
<action android:name="com.appoxee.PUSH_RECEIVED" />
<action android:name="com.appoxee.PUSH_DISMISSED" />
</intent-filter>
</receiver>