urbanairship-core/src/main/java/com/urbanairship/CoreReceiver.java
private void onNotificationOpened(Context context, Intent intent) {
        AirshipConfigOptions options = UAirship.shared().getAirshipConfigOptions();

        PushMessage message = PushMessage.fromIntent(intent);

        if (message == null) {
            Logger.error("CoreReceiver - Intent is missing push message for: " + intent.getAction());
            return;
        }

        boolean shouldLaunchApplication = false;
        Map<String, ActionValue> actionMap = null;
        @Action.Situation int actionSituation = 0;
        Bundle actionMetadata = new Bundle();

        if (intent.hasExtra(PushManager.EXTRA_NOTIFICATION_BUTTON_ID)) {
            boolean isForeground = intent.getBooleanExtra(PushManager.EXTRA_NOTIFICATION_BUTTON_FOREGROUND, false);

            if (isForeground && getResultCode() != AirshipReceiver.RESULT_ACTIVITY_LAUNCHED && options.autoLaunchApplication) {
                shouldLaunchApplication = true;
            }

            if (intent.hasExtra(AirshipReceiver.EXTRA_REMOTE_INPUT)) {
                actionMetadata.putBundle(ActionArguments.REMOTE_INPUT_METADATA, intent.getBundleExtra(AirshipReceiver.EXTRA_REMOTE_INPUT));
            }

            String actionPayload = intent.getStringExtra(PushManager.EXTRA_NOTIFICATION_BUTTON_ACTIONS_PAYLOAD);
            if (!UAStringUtil.isEmpty(actionPayload)) {
                actionMap = parseActionValues(actionPayload);
            }
        } else {
            actionMap = message.getActions();
            actionSituation = Action.SITUATION_PUSH_OPENED;

            if (getResultCode() != AirshipReceiver.RESULT_ACTIVITY_LAUNCHED) {
                PendingIntent contentIntent = (PendingIntent) intent.getExtras().get(PushManager.EXTRA_NOTIFICATION_CONTENT_INTENT);
                if (contentIntent != null) {
                    try {
                        contentIntent.send();
                    } catch (PendingIntent.CanceledException e) {
                        Logger.debug("Failed to send notification's contentIntent, already canceled.");
                    }
                } else if (options.autoLaunchApplication) {
                    shouldLaunchApplication = true;
                }
            }
        }

        actionMetadata.putParcelable(ActionArguments.PUSH_MESSAGE_METADATA, message);

        final int result;
        if (shouldLaunchApplication && launchApplication(context)) {
            result = AirshipReceiver.RESULT_ACTIVITY_LAUNCHED;
        } else {
            result = AirshipReceiver.RESULT_ACTIVITY_NOT_LAUNCHED;
        }

        final boolean isOrderedBroadcast = isOrderedBroadcast();
        final PendingResult pendingResult = goAsync();
        if (isOrderedBroadcast && pendingResult != null) {
            pendingResult.setResultCode(result);
        }

        runActions(context, actionMap, actionSituation, actionMetadata, new Runnable() {
            @Override
            public void run() {
                if (pendingResult != null) {
                    pendingResult.finish();
                }
            }
        });
    }
/**
     * Handles notification opened intent.
     *
     * @param context The application context.
     * @param intent The notification intent.
     */
Handles notification opened intent.
@param context The application context.
@param intent The notification intent.
Handles notification opened intent . @param context The application context . @param intent The notification intent .
private void onNotificationOpened(Context context, Intent intent) {
        AirshipConfigOptions options = UAirship.shared().getAirshipConfigOptions();
        PushMessage message = PushMessage.fromIntent(intent);
        if (message == null) {
            Logger.error("CoreReceiver - Intent is missing push message for: " + intent.getAction());
            return;
        }
        boolean shouldLaunchApplication = false;
        Map<String, ActionValue> actionMap = null;
        @Action.Situation int actionSituation = 0;
        Bundle actionMetadata = new Bundle();
        if (intent.hasExtra(PushManager.EXTRA_NOTIFICATION_BUTTON_ID)) {
            boolean isForeground = intent.getBooleanExtra(PushManager.EXTRA_NOTIFICATION_BUTTON_FOREGROUND, false);
            if (isForeground && getResultCode() != AirshipReceiver.RESULT_ACTIVITY_LAUNCHED && options.autoLaunchApplication) {
                shouldLaunchApplication = true;
            }
            if (intent.hasExtra(AirshipReceiver.EXTRA_REMOTE_INPUT)) {
                actionMetadata.putBundle(ActionArguments.REMOTE_INPUT_METADATA, intent.getBundleExtra(AirshipReceiver.EXTRA_REMOTE_INPUT));
            }
            String actionPayload = intent.getStringExtra(PushManager.EXTRA_NOTIFICATION_BUTTON_ACTIONS_PAYLOAD);
            if (!UAStringUtil.isEmpty(actionPayload)) {
                actionMap = parseActionValues(actionPayload);
            }
        } else {
            actionMap = message.getActions();
            actionSituation = Action.SITUATION_PUSH_OPENED;
            if (getResultCode() != AirshipReceiver.RESULT_ACTIVITY_LAUNCHED) {
                PendingIntent contentIntent = (PendingIntent) intent.getExtras().get(PushManager.EXTRA_NOTIFICATION_CONTENT_INTENT);
                if (contentIntent != null) {
                    try {
                        contentIntent.send();
                    } catch (PendingIntent.CanceledException e) {
                        Logger.debug("Failed to send notification's contentIntent, already canceled.");
                    }
                } else if (options.autoLaunchApplication) {
                    shouldLaunchApplication = true;
                }
            }
        }
        actionMetadata.putParcelable(ActionArguments.PUSH_MESSAGE_METADATA, message);
        final int result;
        if (shouldLaunchApplication && launchApplication(context)) {
            result = AirshipReceiver.RESULT_ACTIVITY_LAUNCHED;
        } else {
            result = AirshipReceiver.RESULT_ACTIVITY_NOT_LAUNCHED;
        }
        final boolean isOrderedBroadcast = isOrderedBroadcast();
        final PendingResult pendingResult = goAsync();
        if (isOrderedBroadcast && pendingResult != null) {
            pendingResult.setResultCode(result);
        }
        runActions(context, actionMap, actionSituation, actionMetadata, new Runnable() {
            @Override
            public void run() {
                if (pendingResult != null) {
                    pendingResult.finish();
                }
            }
        });
    }
private void onNotificationOpened ( Context context , Intent intent ) { AirshipConfigOptions options = UAirship . shared ( ) . getAirshipConfigOptions ( ) ; PushMessage message = PushMessage . fromIntent ( intent ) ; if ( message == null ) { Logger . error ( "CoreReceiver - Intent is missing push message for: " + intent . getAction ( ) ) ; return ; } boolean shouldLaunchApplication = false ; Map < String , ActionValue > actionMap = null ; @ Action . Situation int actionSituation = 0 ; Bundle actionMetadata = new Bundle ( ) ; if ( intent . hasExtra ( PushManager . EXTRA_NOTIFICATION_BUTTON_ID ) ) { boolean isForeground = intent . getBooleanExtra ( PushManager . EXTRA_NOTIFICATION_BUTTON_FOREGROUND , false ) ; if ( isForeground && getResultCode ( ) != AirshipReceiver . RESULT_ACTIVITY_LAUNCHED && options . autoLaunchApplication ) { shouldLaunchApplication = true ; } if ( intent . hasExtra ( AirshipReceiver . EXTRA_REMOTE_INPUT ) ) { actionMetadata . putBundle ( ActionArguments . REMOTE_INPUT_METADATA , intent . getBundleExtra ( AirshipReceiver . EXTRA_REMOTE_INPUT ) ) ; } String actionPayload = intent . getStringExtra ( PushManager . EXTRA_NOTIFICATION_BUTTON_ACTIONS_PAYLOAD ) ; if ( ! UAStringUtil . isEmpty ( actionPayload ) ) { actionMap = parseActionValues ( actionPayload ) ; } } else { actionMap = message . getActions ( ) ; actionSituation = Action . SITUATION_PUSH_OPENED ; if ( getResultCode ( ) != AirshipReceiver . RESULT_ACTIVITY_LAUNCHED ) { PendingIntent contentIntent = ( PendingIntent ) intent . getExtras ( ) . get ( PushManager . EXTRA_NOTIFICATION_CONTENT_INTENT ) ; if ( contentIntent != null ) { try { contentIntent . send ( ) ; } catch ( PendingIntent . CanceledException e ) { Logger . debug ( "Failed to send notification's contentIntent, already canceled." ) ; } } else if ( options . autoLaunchApplication ) { shouldLaunchApplication = true ; } } } actionMetadata . putParcelable ( ActionArguments . PUSH_MESSAGE_METADATA , message ) ; final int result ; if ( shouldLaunchApplication && launchApplication ( context ) ) { result = AirshipReceiver . RESULT_ACTIVITY_LAUNCHED ; } else { result = AirshipReceiver . RESULT_ACTIVITY_NOT_LAUNCHED ; } final boolean isOrderedBroadcast = isOrderedBroadcast ( ) ; final PendingResult pendingResult = goAsync ( ) ; if ( isOrderedBroadcast && pendingResult != null ) { pendingResult . setResultCode ( result ) ; } runActions ( context , actionMap , actionSituation , actionMetadata , new Runnable ( ) { @ Override public void run ( ) { if ( pendingResult != null ) { pendingResult . finish ( ) ; } } } ) ; }
Handles notification opened intent.
Handles notification opened intent .