Initialize Appoxee SDK
This document explains how to add the Appoxee code to your application code
Source code integration
1. In the Application class of your android project, add following code
App application class
public class AppoxeeTestApp extends Application {
...
@Override
public void onCreate() {
super.onCreate();
...
AppoxeeOptions opt = new AppoxeeOptions();
opt.sdkKey = SDK_KEY;
opt.googleProjectId = GOOGLE_PROJECT_ID;
Appoxee.engage(this, opt);
...
}
...
}
pass your SDK Key and google project Id, SDK key is present in your Appoxee Application dashboard. Add application in Android manifest file.
2. For receiving push events like, push received, open, dismissed you need to create on receiver, which extends PushDataReceiver
push receiver
public class MyPushBroadcastReceiver extends PushDataReceiver {
@Override
public void onPushReceived(PushData pushData) {
Log.d("APX", "Push received " + pushData);
}
@Override
public void onPushOpened(PushData pushData) {
Log.d("APX", "Push opened " + pushData);
}
@Override
public void onPushDismissed(PushData pushData) {
Log.d("APX", "Push dismissed " + pushData);
}
}
3. For Custom layout Notifications, add this code in Application class, before calling Appoxee.engage method
Custom Notification
//add this only for the custom layout notifications
CustomXmlLayoutNotificationCreator.Builder builder = new CustomXmlLayoutNotificationCreator.Builder(this);
builder.setLayoutResource(R.layout.custom_notification_layout) //your custom notification layout
.setIconResourceId(R.id.appoxee_default_push_icon)
.setTextResourceId(R.id.appoxee_default_push_message)
.setTitleResourceId(R.id.appoxee_default_push_subject)
.setTimeResourceId(R.id.appoxee_default_push_hour);
opt.customNotificationCreator = new CustomXmlLayoutNotificationCreator(builder);
Appoxee.engage(this, opt);
4. If prompted with an error, add this "Import" command to enable Appoxee SDK usage:
5. Add a callback to appoxee finished all initialization, the callback will be called when Appoxee is up and ready, or if server hand-shaking is failed.
CallBack
6. Another way to check the initialization finish or not is to use following method:
return true when appoxee has finished launching.
Advanced Options (Deep-linking)
Deep Link / URL Scheme in Appoxee & Android, add following code in the manifest file, if you wants to open any other activity from push notification click.
deep linking