urbanairship-core/src/main/java/com/urbanairship/CoreReceiver.java
private void onNotificationButtonOpenedProxy(Context context, Intent intent) {
        PushMessage message = PushMessage.fromIntent(intent);
        if (message == null) {
            Logger.error("CoreReceiver - Intent is missing push message for: " + intent.getAction());
            return;
        }

        Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);

        String notificationActionId = intent.getStringExtra(PushManager.EXTRA_NOTIFICATION_BUTTON_ID);
        if (notificationActionId == null) {
            Logger.error("CoreReceiver - Intent is missing notification button ID: " + intent.getAction());
            return;
        }

        int notificationId = intent.getIntExtra(PushManager.EXTRA_NOTIFICATION_ID, -1);
        boolean isForegroundAction = intent.getBooleanExtra(PushManager.EXTRA_NOTIFICATION_BUTTON_FOREGROUND, true);
        String description = intent.getStringExtra(PushManager.EXTRA_NOTIFICATION_ACTION_BUTTON_DESCRIPTION);

        Logger.info("Notification opened ID: " + notificationId + " action button Id: " + notificationActionId);

        // Set the conversion push id and metadata
        if (isForegroundAction) {
            UAirship.shared().getAnalytics().setConversionSendId(message.getSendId());
            UAirship.shared().getAnalytics().setConversionMetadata(message.getMetadata());
        }

        // Notify the legacy in-app message manager about the push
        UAirship.shared().getLegacyInAppMessageManager().onPushResponse(message);

        // Dismiss the notification
        NotificationManagerCompat.from(context).cancel(notificationId);

        // Add the interactive notification event
        InteractiveNotificationEvent event = new InteractiveNotificationEvent(message, notificationActionId, description, isForegroundAction, remoteInput);
        UAirship.shared().getAnalytics().addEvent(event);

        Intent openIntent = new Intent(PushManager.ACTION_NOTIFICATION_OPENED)
                .putExtras(intent.getExtras())
                .setPackage(UAirship.getPackageName())
                .addCategory(UAirship.getPackageName());

        if (isForegroundAction) {
            openIntent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
        }

        if (remoteInput != null && remoteInput.size() != 0) {
            openIntent.putExtra(AirshipReceiver.EXTRA_REMOTE_INPUT, remoteInput);
        }

        context.sendOrderedBroadcast(openIntent, null);
    }
/**
     * Handles the opened notification button.
     *
     * @param context The application context.
     * @param intent The notification intent.
     */
Handles the opened notification button.
@param context The application context.
@param intent The notification intent.
Handles the opened notification button . @param context The application context . @param intent The notification intent .
private void onNotificationButtonOpenedProxy(Context context, Intent intent) {
        PushMessage message = PushMessage.fromIntent(intent);
        if (message == null) {
            Logger.error("CoreReceiver - Intent is missing push message for: " + intent.getAction());
            return;
        }
        Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
        String notificationActionId = intent.getStringExtra(PushManager.EXTRA_NOTIFICATION_BUTTON_ID);
        if (notificationActionId == null) {
            Logger.error("CoreReceiver - Intent is missing notification button ID: " + intent.getAction());
            return;
        }
        int notificationId = intent.getIntExtra(PushManager.EXTRA_NOTIFICATION_ID, -1);
        boolean isForegroundAction = intent.getBooleanExtra(PushManager.EXTRA_NOTIFICATION_BUTTON_FOREGROUND, true);
        String description = intent.getStringExtra(PushManager.EXTRA_NOTIFICATION_ACTION_BUTTON_DESCRIPTION);
        Logger.info("Notification opened ID: " + notificationId + " action button Id: " + notificationActionId);
        if (isForegroundAction) {
            UAirship.shared().getAnalytics().setConversionSendId(message.getSendId());
            UAirship.shared().getAnalytics().setConversionMetadata(message.getMetadata());
        }
        UAirship.shared().getLegacyInAppMessageManager().onPushResponse(message);
        NotificationManagerCompat.from(context).cancel(notificationId);
        InteractiveNotificationEvent event = new InteractiveNotificationEvent(message, notificationActionId, description, isForegroundAction, remoteInput);
        UAirship.shared().getAnalytics().addEvent(event);
        Intent openIntent = new Intent(PushManager.ACTION_NOTIFICATION_OPENED)
                .putExtras(intent.getExtras())
                .setPackage(UAirship.getPackageName())
                .addCategory(UAirship.getPackageName());
        if (isForegroundAction) {
            openIntent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
        }
        if (remoteInput != null && remoteInput.size() != 0) {
            openIntent.putExtra(AirshipReceiver.EXTRA_REMOTE_INPUT, remoteInput);
        }
        context.sendOrderedBroadcast(openIntent, null);
    }
private void onNotificationButtonOpenedProxy ( Context context , Intent intent ) { PushMessage message = PushMessage . fromIntent ( intent ) ; if ( message == null ) { Logger . error ( "CoreReceiver - Intent is missing push message for: " + intent . getAction ( ) ) ; return ; } Bundle remoteInput = RemoteInput . getResultsFromIntent ( intent ) ; String notificationActionId = intent . getStringExtra ( PushManager . EXTRA_NOTIFICATION_BUTTON_ID ) ; if ( notificationActionId == null ) { Logger . error ( "CoreReceiver - Intent is missing notification button ID: " + intent . getAction ( ) ) ; return ; } int notificationId = intent . getIntExtra ( PushManager . EXTRA_NOTIFICATION_ID , - 1 ) ; boolean isForegroundAction = intent . getBooleanExtra ( PushManager . EXTRA_NOTIFICATION_BUTTON_FOREGROUND , true ) ; String description = intent . getStringExtra ( PushManager . EXTRA_NOTIFICATION_ACTION_BUTTON_DESCRIPTION ) ; Logger . info ( "Notification opened ID: " + notificationId + " action button Id: " + notificationActionId ) ; if ( isForegroundAction ) { UAirship . shared ( ) . getAnalytics ( ) . setConversionSendId ( message . getSendId ( ) ) ; UAirship . shared ( ) . getAnalytics ( ) . setConversionMetadata ( message . getMetadata ( ) ) ; } UAirship . shared ( ) . getLegacyInAppMessageManager ( ) . onPushResponse ( message ) ; NotificationManagerCompat . from ( context ) . cancel ( notificationId ) ; InteractiveNotificationEvent event = new InteractiveNotificationEvent ( message , notificationActionId , description , isForegroundAction , remoteInput ) ; UAirship . shared ( ) . getAnalytics ( ) . addEvent ( event ) ; Intent openIntent = new Intent ( PushManager . ACTION_NOTIFICATION_OPENED ) . putExtras ( intent . getExtras ( ) ) . setPackage ( UAirship . getPackageName ( ) ) . addCategory ( UAirship . getPackageName ( ) ) ; if ( isForegroundAction ) { openIntent . addFlags ( Intent . FLAG_RECEIVER_FOREGROUND ) ; } if ( remoteInput != null && remoteInput . size ( ) != 0 ) { openIntent . putExtra ( AirshipReceiver . EXTRA_REMOTE_INPUT , remoteInput ) ; } context . sendOrderedBroadcast ( openIntent , null ) ; }
Handles the opened notification button.
Handles the opened notification button .
// Set the conversion push id and metadata // Notify the legacy in-app message manager about the push // Dismiss the notification // Add the interactive notification event