In-app Notifications

Configure target rules for in-app notifications.

In-app Messaging includes both Banners and Surveys. They are displayed on the basis of user activities on android.

Every event occurs in the context of an Activity. Every activity can be associated with some contextual data, which can be used as targeting rules for In-app Messaging.

Use the below show() Method for every activity. show() Method should be used only once as per the activity.

NotifyVisitorsApi.getInstance(this).show(null,null,null);

Show() method has three attributes:

  1. Dynamic Tokens (JsonObject)
  2. Custom Rules (JsonObject)
  3. Fragment Name (String)

DYNAMIC TOKENS (JSON Object)

Dynamic tokens are used to show personalized content in Notification messages in real time.

JSONObject category = new JSONObject();
try {
   category.put("firstCategory","standard");
   category.put("secondCategory","fancy");
} catch (JSONException e) {
   e.printStackTrace();
}

CUSTOM RULES (JSON Object)

This data can be used in configuring targeting rules for the Notifications.

JSONObject category = new JSONObject();
try {
    category.put("categoryID","101");
    category.put("categoryName","shoes");
} catch (JSONException e) {
    e.printStackTrace();
}

FRAGMENT NAME (string)

If you have multiple fragment tabs in your activity, you can use the show method for each fragment and pass the fragment name as the third argument.

In-app Notifications Response Callback

If you want to get callback data whenever user clicks on in-app banners or fill-up surveys.

NotifyVisitorsApi.getInstance(context).getEventResponse(new OnEventTrackListener() {
                @Override
                public void onResponse(JSONObject jsonObject) {
                            // do your task
                }
            });

What’s Next