/** * Action the notification: this will display the announcement or poll, or will launch the action * URL associated to the notification, depending of the content kind. This will also report the * notification has been actioned. * * @param context any application context. * @param launchIntent true to launch intent, false to just report the notification action and * change internal state. If you call this method passing false, be sure that the content is * either a notification only announcement or that you properly manage the content display and * its life cycle (by calling actionContent or exitContent when the user is done viewing the * content). */ public void actionNotification(Context context, boolean launchIntent) { /* Notify agent if intent must be launched */ EngagementReachAgent.getInstance(context).onNotificationActioned(this, launchIntent); /* Send feedback */ if (!mNotificationActioned) { mCampaignId.sendFeedBack(context, getNotificationStatusPrefix() + "actioned", null); mNotificationActioned = true; } }
/** * Report content has been displayed. * * @param context any application context. */ public void displayContent(Context context) { /* Notify reach agent */ EngagementReachAgent.getInstance(context).onContentDisplayed(this); /* Guard against multiple calls for feedback */ if (!mContentDisplayed) { mCampaignId.sendFeedBack(context, "content-displayed", null); mContentDisplayed = true; } }
/** * Report notification has been displayed. * * @param context any application context. */ public void displayNotification(Context context) { /* Update last displayed date */ mNotificationLastDisplayedDate = System.currentTimeMillis(); /* First date and reach feedback the first time */ if (mNotificationFirstDisplayedDate == null) { mNotificationFirstDisplayedDate = mNotificationLastDisplayedDate; mCampaignId.sendFeedBack(context, getNotificationStatusPrefix() + "displayed", null); } /* Notify reach agent */ EngagementReachAgent.getInstance(context).onNotificationDisplayed(this); }