List of usage examples for android.content Intent FLAG_ACTIVITY_CLEAR_TASK
int FLAG_ACTIVITY_CLEAR_TASK
To view the source code for android.content Intent FLAG_ACTIVITY_CLEAR_TASK.
Click Source Link
From source file:id.satusatudua.sigap.ui.HelpingActivity.java
public static Intent generateIntent(Context context, Case theCase, User reporter) { Intent intent = new Intent(context, HelpingActivity.class); intent.putExtra(KEY_CASE, theCase);//from w w w . ja va 2 s . c om intent.putExtra(KEY_REPORTER, reporter); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); return intent; }
From source file:com.williamcomartin.plexpyremote.AboutActivity.java
@Override public void onBackPressed() { if (mainDrawerLayout.isDrawerOpen(GravityCompat.START)) { super.onBackPressed(); return;/*w w w . j av a 2 s .c o m*/ } Intent intent = new Intent(this, ActivityActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); }
From source file:id.satusatudua.sigap.ui.GuardingActivity.java
public static Intent generateIntent(Context context) { Intent intent = new Intent(context, GuardingActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); return intent; }
From source file:com.truiton.foregroundservice.ForegroundService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent.getAction().equals(Constants.ACTION.STARTFOREGROUND_ACTION)) { Log.i(LOG_TAG, "Received Start Foreground Intent "); Intent notificationIntent = new Intent(this, MainActivity.class); notificationIntent.setAction(Constants.ACTION.MAIN_ACTION); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); Intent previousIntent = new Intent(this, ForegroundService.class); previousIntent.setAction(Constants.ACTION.PREV_ACTION); PendingIntent ppreviousIntent = PendingIntent.getService(this, 0, previousIntent, 0); Intent playIntent = new Intent(this, ForegroundService.class); playIntent.setAction(Constants.ACTION.PLAY_ACTION); PendingIntent pplayIntent = PendingIntent.getService(this, 0, playIntent, 0); Intent nextIntent = new Intent(this, ForegroundService.class); nextIntent.setAction(Constants.ACTION.NEXT_ACTION); PendingIntent pnextIntent = PendingIntent.getService(this, 0, nextIntent, 0); Bitmap icon = BitmapFactory.decodeResource(getResources(), R.drawable.truiton_short); Notification notification = new NotificationCompat.Builder(this).setContentTitle("Truiton Music Player") .setTicker("Truiton Music Player").setContentText("My Music") .setSmallIcon(R.drawable.ic_launcher) .setLargeIcon(Bitmap.createScaledBitmap(icon, 128, 128, false)).setContentIntent(pendingIntent) .setOngoing(true).addAction(android.R.drawable.ic_media_previous, "Previous", ppreviousIntent) .addAction(android.R.drawable.ic_media_play, "Play", pplayIntent) .addAction(android.R.drawable.ic_media_next, "Next", pnextIntent).build(); startForeground(Constants.NOTIFICATION_ID.FOREGROUND_SERVICE, notification); } else if (intent.getAction().equals(Constants.ACTION.PREV_ACTION)) { Log.i(LOG_TAG, "Clicked Previous"); } else if (intent.getAction().equals(Constants.ACTION.PLAY_ACTION)) { Log.i(LOG_TAG, "Clicked Play"); } else if (intent.getAction().equals(Constants.ACTION.NEXT_ACTION)) { Log.i(LOG_TAG, "Clicked Next"); } else if (intent.getAction().equals(Constants.ACTION.STOPFOREGROUND_ACTION)) { Log.i(LOG_TAG, "Received Stop Foreground Intent"); stopForeground(true);/*from w ww . j ava2s . co m*/ stopSelf(); } return START_STICKY; }
From source file:at.wada811.dayscounter.view.activity.SettingsActivity.java
public static PendingIntent createPendingIntent(Context context, int appWidgetId) { Intent intent = new Intent(context, SettingsActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); return PendingIntent.getActivity(context, appWidgetId, intent, PendingIntent.FLAG_CANCEL_CURRENT); }
From source file:org.jboss.aerogear.android.push.NotifyingHandler.java
private void sendNotification(String msg) { mNotificationManager = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE); PendingIntent contentIntent = PendingIntent.getActivity(ctx, 0, new Intent(ctx, MainActivity.class) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK).putExtra("alert", msg), 0); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(ctx) .setSmallIcon(R.drawable.ic_launcher).setContentTitle("GCM Notification") .setStyle(new NotificationCompat.BigTextStyle().bigText(msg)).setContentText(msg); mBuilder.setContentIntent(contentIntent); mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); }
From source file:com.saarang.samples.apps.iosched.ui.debug.actions.ShowSessionNotificationDebugAction.java
@Override public void run(Context context, Callback callback) { Intent i = new Intent(Intent.ACTION_VIEW, ScheduleContract.Sessions.buildSessionUri("__keynote__")); PendingIntent pi = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_CANCEL_CURRENT); Intent mapIntent = new Intent(context, UIUtils.getMapActivityClass(context)); mapIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME); mapIntent.putExtra(BaseMapActivity.EXTRA_ROOM, "keynote"); PendingIntent piMap = TaskStackBuilder.create(context).addNextIntent(mapIntent).getPendingIntent(0, PendingIntent.FLAG_CANCEL_CURRENT); //= PendingIntent.getActivity(context, 0, mapIntent, 0); NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(context) .setContentTitle("test notification").setContentText("yep, this is a test") .setTicker("hey, you got a test") .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE) .setSmallIcon(com.saarang.samples.apps.iosched.R.drawable.ic_stat_notification).setContentIntent(pi) .setPriority(Notification.PRIORITY_MAX).setAutoCancel(true); notifBuilder.addAction(com.saarang.samples.apps.iosched.R.drawable.ic_map_holo_dark, context.getString(com.saarang.samples.apps.iosched.R.string.title_map), piMap); NotificationCompat.InboxStyle richNotification = new NotificationCompat.InboxStyle(notifBuilder) .setBigContentTitle(context.getResources().getQuantityString( com.saarang.samples.apps.iosched.R.plurals.session_notification_title, 1, 8, 1)); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(32534, richNotification.build()); }
From source file:com.google.samples.apps.iosched.debug.actions.ShowSessionNotificationDebugAction.java
@Override public void run(Context context, Callback callback) { Intent i = new Intent(Intent.ACTION_VIEW, ScheduleContract.Sessions.buildSessionUri("__keynote__")); PendingIntent pi = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_CANCEL_CURRENT); Intent mapIntent = new Intent(context, MapActivity.class); mapIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME); mapIntent.putExtra(MapActivity.EXTRA_ROOM, "keynote"); PendingIntent piMap = TaskStackBuilder.create(context).addNextIntent(mapIntent).getPendingIntent(0, PendingIntent.FLAG_CANCEL_CURRENT); //= PendingIntent.getActivity(context, 0, mapIntent, 0); NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(context) .setContentTitle("test notification").setContentText("yep, this is a test") .setTicker("hey, you got a test") .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE) .setSmallIcon(R.drawable.ic_stat_notification).setContentIntent(pi) .setPriority(Notification.PRIORITY_MAX).setAutoCancel(true); notifBuilder.addAction(R.drawable.ic_map_holo_dark, context.getString(R.string.title_map), piMap); NotificationCompat.InboxStyle richNotification = new NotificationCompat.InboxStyle(notifBuilder) .setBigContentTitle(//w w w . j a va 2s . c o m context.getResources().getQuantityString(R.plurals.session_notification_title, 1, 8, 1)); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(32534, richNotification.build()); }
From source file:com.google.samples.apps.iosched.ui.debug.actions.ShowSessionNotificationDebugAction.java
@Override public void run(Context context, Callback callback) { Intent i = new Intent(Intent.ACTION_VIEW, ScheduleContract.Sessions.buildSessionUri("__keynote__")); PendingIntent pi = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_CANCEL_CURRENT); Intent mapIntent = new Intent(context, UIUtils.getMapActivityClass(context)); mapIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME); mapIntent.putExtra(BaseMapActivity.EXTRA_ROOM, "keynote"); PendingIntent piMap = TaskStackBuilder.create(context).addNextIntent(mapIntent).getPendingIntent(0, PendingIntent.FLAG_CANCEL_CURRENT); //= PendingIntent.getActivity(context, 0, mapIntent, 0); NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(context) .setContentTitle("test notification").setContentText("yep, this is a test") .setTicker("hey, you got a test") .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE) .setSmallIcon(R.drawable.ic_stat_notification).setContentIntent(pi) .setPriority(Notification.PRIORITY_MAX).setAutoCancel(true); notifBuilder.addAction(R.drawable.ic_map_holo_dark, context.getString(R.string.title_map), piMap); NotificationCompat.InboxStyle richNotification = new NotificationCompat.InboxStyle(notifBuilder) .setBigContentTitle(//from w w w . j av a 2 s . co m context.getResources().getQuantityString(R.plurals.session_notification_title, 1, 8, 1)); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(32534, richNotification.build()); }
From source file:com.rks.musicx.ui.activities.EqualizerActivity.java
@Override public void onBackPressed() { super.onBackPressed(); Intent intent = new Intent(this, PlayingActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent);/* w w w . j a v a 2s. c om*/ }