Inbox SDK Integration for Android

The following document describes how to integrate the Android SDK to support Inbox Messaging. For Inbox and In-App action handling, see Android Inbox and In-App Action Handling.

In-App and Inbox Messaging for Mapp Cloud Integrated are only available with Android SDK v5.0+

Call to fetch the inbox messages

Appoxee.instance().fetchInboxMessages(YourActivity.this);

Callback for the inbox messages received in an Activity.

InAppInboxCallback inAppInboxCallback = new InAppInboxCallback(); inAppInboxCallback.addInAppInboxMessagesReceivedCallback(new InAppInboxCallback.onInAppInboxMessagesReceived() { @Override public void onInAppInboxMessages(List<APXInboxMessage> richMessages) {   runOnUiThread(new Runnable() { @Override public void run() { //Just because we are receiving this callback from a background thread, if you need to update the UI anyhow, Please do that in the main thread. //null in case of empty list. } }); } @Override public void onInAppInboxMessage(final APXInboxMessage message) { runOnUiThread(new Runnable() { @Override public void run() { //Just because we are receiving this callback from a background thread, if you need to update the UI anyhow, Please do that in the main thread. //null in case of empty message object. } }); } });

 

public class APXInboxMessage implements Serializable { private String eventId; private int templateId; private String content; private String subject; private String summary; private String iconUrl; private String status; private List<ApxInAppExtras> extras; private Date sentDate; private Date expirationDate; public enum MESSAGE_STATUS{ READ, UNREAD, DELETED; } private Context mContext; private static Logger devLog = LoggerFactory.getDevLogger(); private final String DEEPLINK = "deepLink"; private final String CUSTOM = "custom"; private final String INBOX = "inbox"; private final String APP_STORE = "appStore"; private final String LANDING_PAGE = "landingPage"; private final String APX_ACTION = "apxAction"; private Map<String, List<String>> queryPairs; private final String APX_DEEPLINK_STRING = "apx://deeplink?link="; private final String APX_CUSTOM_DEEPLINK_STRING = "apx://custom?link="; private final String APX_INBOX_DEEPLINK_STRING = "apx://inbox?message_id="; private final String APX_LAUNCH_DEEPLINK_ACTION = "com.appoxee.VIEW_DEEPLINK"; private final String APX_LAUNCH_CUSTOM_ACTION = "com.appoxee.VIEW_CUSTOM_LINKS"; private final String APX_LAUNCH_INBOX_ACTION = "com.appoxee.VIEW_INBOX"; public Date getSentDate() { return sentDate; } public void setSentDate (Date sentDate) { this.sentDate = sentDate; } public Date getExpirationDate() { return expirationDate; } public void setExpirationDate (Date expirationDate) { this.expirationDate = expirationDate; } public String getEventId() { return eventId; } public int getTemplateId() { return templateId; } public String getContent() { return content; } public String getSubject() { return subject; } public String getSummary() { return summary; } public String getIconUrl() { return iconUrl; } public String getStatus() { return status; } public void setEventId(String eventId) { this.eventId = eventId; } public void setTemplateId(int templateId) { this.templateId = templateId; } public void setContent(String content) { this.content = content; } public void setSubject(String subject) { this.subject = subject; } public void setSummary(String summary) { this.summary = summary; } public void setIconUrl(String iconUrl) { this.iconUrl = iconUrl; } public void setStatus(String status) { this.status = status; } public List<ApxInAppExtras> getExtras() { return extras; } public void setExtras(List<ApxInAppExtras> extras) { this.extras = extras; } public void markAsRead(Context context) { this.setStatus(MESSAGE_STATUS.READ.name()); Appoxee.instance().triggerStatistcs(context, UiUtils.getInAppStatisticsRequestObject(this.templateId, this.getEventId(), InAppStatistics.INBOX_INBOX_MESSAGE_READ_KEY, null,null,null)); } public void markAsUnRead(Context context) { this.setStatus(MESSAGE_STATUS.UNREAD.name()); Appoxee.instance().triggerStatistcs(context, UiUtils.getInAppStatisticsRequestObject(this.templateId, this.getEventId(), InAppStatistics.INBOX_INBOX_MESSAGE_UNREAD_KEY, null,null,null)); } public void markAsDeleted(Context context) { this.setStatus(MESSAGE_STATUS.DELETED.name()); Appoxee.instance().triggerStatistcs(context, UiUtils.getInAppStatisticsRequestObject(this.templateId, this.getEventId(), InAppStatistics.INBOX_INBOX_MESSAGE_DELETED_KEY, null,null,null)); } public boolean handleAction(String url, Context ctx, WebView webview){ //This is the Sdk method to handle the deeplinks. }   }


When the list of messages are received: 

  1. Populate the list in your own recyclerView and give the screen your own look and feel

  2. Once your view is ready add a touch listener and get

     

  3.  To your webView add CustomWebViewClient and pass in the 

 

Push + Inbox Support

<key, value>

<apx_inbox, messageId>

AndroidManifest.xml

Inside your Inbox Activity get the action

Get the Inbox message Object corresponding to the message id thats received in the push inside the following callback.