Java Code Examples for android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP
The following examples show how to use
android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CallNotificationManager.java From react-native-twilio-programmable-voice with MIT License | 5 votes |
public Intent getLaunchIntent(ReactApplicationContext context, int notificationId, CallInvite callInvite, Boolean shouldStartNewTask, int appImportance ) { Intent launchIntent = new Intent(context, getMainActivityClass(context)); int launchFlag = Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP; if (shouldStartNewTask || appImportance != ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) { launchFlag = Intent.FLAG_ACTIVITY_NEW_TASK; } launchIntent.setAction(ACTION_INCOMING_CALL) .putExtra(INCOMING_CALL_NOTIFICATION_ID, notificationId) .addFlags( launchFlag + WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED + WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD + WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON + WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON ); if (callInvite != null) { launchIntent.putExtra(INCOMING_CALL_INVITE, callInvite); } return launchIntent; }