@ SuppressWarnings ( { "unused" , "WeakerAccess" } ) public void pushNotificationViewedEvent ( Bundle extras ) { if ( extras == null || extras . isEmpty ( ) || extras . get ( Constants . NOTIFICATION_TAG ) == null ) { getConfigLogger ( ) . debug ( getAccountId ( ) , "Push notification: " + ( extras == null ? "NULL" : extras . toString ( ) ) + " not from CleverTap - will not process Notification Viewed event." ) ; return ; } if ( ! extras . containsKey ( Constants . NOTIFICATION_ID_TAG ) || ( extras . getString ( Constants . NOTIFICATION_ID_TAG ) == null ) ) { getConfigLogger ( ) . debug ( getAccountId ( ) , "Push notification ID Tag is null, not processing Notification Viewed event for: " + extras . toString ( ) ) ; return ; } // Check for dupe notification views; if same notficationdId within specified time interval (2 secs) don't process boolean isDuplicate = checkDuplicateNotificationIds ( extras , notificationViewedIdTagMap , Constants . NOTIFICATION_VIEWED_ID_TAG_INTERVAL ) ; if ( isDuplicate ) { getConfigLogger ( ) . debug ( getAccountId ( ) , "Already processed Notification Viewed event for " + extras . toString ( ) + ", dropping duplicate." ) ; return ; } JSONObject event = new JSONObject ( ) ; try { JSONObject notif = getWzrkFields ( extras ) ; event . put ( "evtName" , Constants . NOTIFICATION_VIEWED_EVENT_NAME ) ; event . put ( "evtData" , notif ) ; } catch ( Throwable ignored ) { //no-op } queueEvent ( context , event , Constants . RAISED_EVENT ) ; }
Pushes the Notification Viewed event to CleverTap .