Search results for "{{ search.query }}"

No results found for "{{search.query}}". 
View All Results

Engagement / In-App / Notifications(Old)

Callbacks

Implement you class with InAppNotificationCallbacks and register it to WebEngage.

public class MyApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        WebEngage.registerInAppNotificationCallback(new InAppNotificationCallback());
    }
}

1. In-App Notification Received

InAppNotificationData onInAppNotificationPrepared(Context context, InAppNotificationData inAppNotificationData)

This callback gets triggered before IN-APP notification is shown . This is point to where you can make any tweaks or customisation to IN-APP notification data received from server.

2. In-App Notification Shown

void onInAppNotificationShown(Context context, InAppNotificationData inAppNotificationData)

This callback gets triggered after the notification is shown

3. In-App Notification Clicked

boolean onInAppNotificationClicked(Context context, InAppNotificationData inAppNotificationData, String actionId)

This callback gets triggered when user clicks the notification . The id of the button clicked is passed as third parameter.
Return true if click was handled else false.

4. In-App Notification Dismissed

void onInAppNotificationDismissed(Context context, InAppNotificationData inAppNotificationData)

This callbacks gets triggered when the notification is dismissed either by swiping it away or by clearing system tray.

public class InAppNotificationCallbacksImpl implements InAppNotificationCallbacks {

    private static final String TAG = "InAppNotificationCallbacksImpl";

    @Override
    public InAppNotificationData onInAppNotificationPrepared(Context context, InAppNotificationData inAppNotificationData) {
        Log.d(TAG, "Notification is about to get displayed , Experiment Id : " + inAppNotificationData.getExperimentId());
        return inAppNotificationData;
    }

    @Override
    public void onInAppNotificationShown(Context context, InAppNotificationData inAppNotificationData) {
        Log.d(TAG, "Notification shown , Experiment Id : " + inAppNotificationData.getExperimentId());
    }

    @Override
    public boolean onInAppNotificationClicked(Context context, InAppNotificationData inAppNotificationData, String actionId) {
        Log.d(TAG, "User clicked notification , Experiment Id : " + inAppNotificationData.getExperimentId());
        return false;
    }

    @Override
    public void onInAppNotificationDismissed(Context context, InAppNotificationData inAppNotificationData) {
        Log.d(TAG, "Notification Dismissed , Experiment Id : " + inAppNotificationData.getExperimentId());
    }
}

Notification Callback Data (org.json.JSONObject)

JSONObject data = inAppNotificationData.getData();
{
    "canClose": true,
    "layoutAttributes": {
        "posX": 0,
        "posY": 0,
        "TITLE_ALIGN": "CENTER",
        "image_url": "http://s3-ap-southeast-1.amazonaws.com/wk-test-static-files/76a9d10/a6b6e04d-43e9-4c09-b15f-8acffbcfcc1a.jpg",
        "TITLE_WRAP": false,
        "wvWidth": 100,
        "type": "BLOCKING",
        "wvHeight": 100,
        "fullScreen": false
    },
    "showTitle": true,
    "notificationEncId": "~13ssb59",
    "description": null,
    "canMinimize": true,
    "id": "173046a46",
    "isActive": true,
    "title": "My Title",
    "actions": [{
        "actionText": "Puma",
        "actionEId": "~64c71b",
        "actionTarget": "_top",
        "type": "DEEP_LINK",
        "actionLink": "webengage://com.webengage.inapptest/start_activity/com.webengage.inapptest.Activity1",
        "isPrime": true
    }],
    "config": {
        "titleColor": "#ffffff",
        "c2aBackgroundColor": "#411ad3",
        "c2aTextFont": "Open Sans",
        "titleFont": "Open Sans",
        "c2aTextColor": "#f7f2f2",
        "hideLogo": false
    },
    "direction": "ltr"
}

Engagement / In-App / Notifications(Old)