Example usage for android.content Intent FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS

List of usage examples for android.content Intent FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS

Introduction

In this page you can find the example usage for android.content Intent FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS.

Prototype

int FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS

To view the source code for android.content Intent FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS.

Click Source Link

Document

If set, the new activity is not kept in the list of recently launched activities.

Usage

From source file:com.crea_si.eviacam.wizard.WizardUtils.java

static void finishWizard(Activity a) {
    a.startActivity(new Intent(a, WizardActivity.class)
            .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS));
    a.finish();/*from w  w w.j a  va 2  s  .c  o  m*/
}

From source file:Main.java

public static void startInstalledAppDetailsActivity(@Nullable final Activity context) {
    if (context == null) {
        return;/*from ww  w .  j a v  a2s  .co m*/
    }
    final Intent i = new Intent();
    i.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    i.addCategory(Intent.CATEGORY_DEFAULT);
    i.setData(Uri.parse("package:" + context.getPackageName()));
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    i.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
    context.startActivity(i);
}

From source file:Main.java

/**
 * Opens browser with special flags for no history/recents/etc
 * // w  ww . j av  a 2  s. c  om
 * @param ctx
 *            context to use
 * @param url
 *            url to open
 */
public static void openNoHistory(Context ctx, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
    intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    ctx.startActivity(intent);
}

From source file:com.android.inputmethod.latin.permissions.PermissionsActivity.java

/**
 * Starts a PermissionsActivity and checks/requests supplied permissions.
 *//*  w w  w.j a  v  a 2s . co m*/
public static void run(@NonNull Context context, int requestCode, @NonNull String... permissionStrings) {
    Intent intent = new Intent(context.getApplicationContext(), PermissionsActivity.class);
    intent.putExtra(EXTRA_PERMISSION_REQUESTED_PERMISSIONS, permissionStrings);
    intent.putExtra(EXTRA_PERMISSION_REQUEST_CODE, requestCode);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
    context.startActivity(intent);
}

From source file:com.numenta.htmit.mobile.notification.NotificationUtils.java

/**
 * Create {@link MetricDetailActivity} {@link Intent} configured to be used
 * as the notification result intent for the given notification and the
 * given metric//from   www  . j ava2  s. c  o m
 *
 * @param ctx The {@link Context}
 * @param notification The {@link Notification}
 * @return A new {@link Intent} that will open the
 *         {@link MetricDetailActivity} showing the metric data associated
 *         with the notification.
 * @see #createOSNotification(String, long, int, long)
 * @see NotificationListActivity
 */
public static Intent createMetricDetailIntent(final Context ctx, final Notification notification) {
    final HTMITDatabase database = HTMITApplication.getDatabase();
    final Metric metric = database.getMetric(notification.getMetricId());
    final Intent resultIntent = new Intent(ctx, MetricDetailActivity.class);
    resultIntent.setFlags(
            Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
            // | Intent.FLAG_ACTIVITY_SINGLE_TOP
                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
    resultIntent.putExtra(MetricDetailActivity.EXTRA_METRIC, metric.getId());
    resultIntent.putExtra(MetricDetailActivity.EXTRA_DATE, notification.getTimestamp());
    return resultIntent;

}

From source file:com.groksolutions.grok.mobile.notification.NotificationUtils.java

/**
 * Create {@link MetricDetailActivity} {@link Intent} configured to be used
 * as the notification result intent for the given notification and the
 * given metric//  ww  w  . j a  v  a 2  s. c  o  m
 *
 * @param ctx The {@link Context}
 * @param notification The {@link Notification}
 * @return A new {@link Intent} that will open the
 *         {@link MetricDetailActivity} showing the metric data associated
 *         with the notification.
 * @see #createOSNotification(String, long, int, long)
 * @see NotificationListActivity
 */
public static Intent createMetricDetailIntent(final Context ctx, final Notification notification) {
    final GrokDatabase grokDb = HTMITApplication.getDatabase();
    final Metric metric = grokDb.getMetric(notification.getMetricId());
    final Intent resultIntent = new Intent(ctx, MetricDetailActivity.class);
    resultIntent.setFlags(
            Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
            // | Intent.FLAG_ACTIVITY_SINGLE_TOP
                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
    resultIntent.putExtra(MetricDetailActivity.EXTRA_METRIC, metric.getId());
    resultIntent.putExtra(MetricDetailActivity.EXTRA_DATE, notification.getTimestamp());
    return resultIntent;

}

From source file:com.YOMPsolutions.YOMP.mobile.notification.NotificationUtils.java

/**
 * Create {@link MetricDetailActivity} {@link Intent} configured to be used
 * as the notification result intent for the given notification and the
 * given metric/*from w  w w. j  a  va  2s .c  o m*/
 *
 * @param ctx The {@link Context}
 * @param notification The {@link Notification}
 * @return A new {@link Intent} that will open the
 *         {@link MetricDetailActivity} showing the metric data associated
 *         with the notification.
 * @see #createOSNotification(String, long, int, long)
 * @see NotificationListActivity
 */
public static Intent createMetricDetailIntent(final Context ctx, final Notification notification) {
    final YOMPDatabase YOMPDb = YOMPApplication.getDatabase();
    final Metric metric = YOMPDb.getMetric(notification.getMetricId());
    final Intent resultIntent = new Intent(ctx, MetricDetailActivity.class);
    resultIntent.setFlags(
            Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
            // | Intent.FLAG_ACTIVITY_SINGLE_TOP
                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
    resultIntent.putExtra(MetricDetailActivity.EXTRA_METRIC, metric.getId());
    resultIntent.putExtra(MetricDetailActivity.EXTRA_DATE, notification.getTimestamp());
    return resultIntent;

}

From source file:com.commonsware.android.backup.RestoreRosterFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    String url = BuildConfig.URL_SERVER + adapter.getItem(position).dataset;
    Intent i = new Intent(getActivity(), RestoreProgressActivity.class).setData(Uri.parse(url))
            .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK
                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);

    startActivity(i);/*from  w ww  .  ja  v  a  2  s.c  o m*/
}

From source file:org.durka.hallmonitor.CoreService.java

@Override
public void onCreate() {
    Log.d(LOG_TAG + ".oC", "Core service creating");
    localCoreService = this;

    mStateManager = ((CoreApp) getApplicationContext()).getStateManager();

    Log.d(LOG_TAG + ".oC", "Register special actions");
    mStateManager.registerCoreService(this);

    mStateManager.registerCoreReceiver();

    mLocalBroadcastManager = LocalBroadcastManager.getInstance(this);

    HandlerThread thread = new HandlerThread("ServiceStartArguments", Process.THREAD_PRIORITY_BACKGROUND);
    thread.start();//from ww  w. jav  a2 s.  c o m

    // Get the HandlerThread's Looper and use it for our Handler
    mTouchCoverLooper = thread.getLooper();
    mTouchCoverHandler = new TouchCoverHandler(mTouchCoverLooper);
    lastTouchCoverRequest = mStateManager.getCoverClosed();

    try {
        startActivityAsUser = ((ContextWrapper) this).getClass().getMethod("startActivityAsUser", Intent.class,
                UserHandle.class);
        Log.d(LOG_TAG, "startActivityAsUser registred");
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }

    launchDefaultActivity = new Intent(localCoreService, DefaultActivity.class)
            .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION
                    | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);

    mUserHandle = android.os.Process.myUserHandle();
}

From source file:com.fn.reunion.app.xmpp.Notifier.java

public void notify(String notificationId, String apiKey, String title, String message, String uri) {
    Log.d(LOGTAG, "notify()...");

    Log.d(LOGTAG, "notificationId=" + notificationId);
    Log.d(LOGTAG, "notificationApiKey=" + apiKey);
    Log.d(LOGTAG, "notificationTitle=" + title);
    Log.d(LOGTAG, "notificationMessage=" + message);
    Log.d(LOGTAG, "notificationUri=" + uri);

    if (isNotificationEnabled()) {
        // Show the toast
        if (isNotificationToastEnabled()) {
            Toast.makeText(context, message, Toast.LENGTH_LONG).show();
        }//from ww w . j  ava 2s.c o m

        Notification notification = new Notification();
        notification.icon = getNotificationIcon();
        notification.defaults = Notification.DEFAULT_LIGHTS;

        if (isNotificationSoundEnabled()) {
            notification.defaults |= Notification.DEFAULT_SOUND;
        }

        if (isNotificationVibrateEnabled()) {
            notification.defaults |= Notification.DEFAULT_VIBRATE;
        }

        notification.flags |= Notification.FLAG_AUTO_CANCEL;
        notification.when = System.currentTimeMillis();
        notification.tickerText = message;

        Intent intent = new Intent(context, NotificationDetailsActivity.class);
        intent.putExtra(Constants.NOTIFICATION_ID, notificationId);
        intent.putExtra(Constants.NOTIFICATION_API_KEY, apiKey);
        intent.putExtra(Constants.NOTIFICATION_TITLE, title);
        intent.putExtra(Constants.NOTIFICATION_MESSAGE, message);
        intent.putExtra(Constants.NOTIFICATION_URI, uri);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

        PendingIntent contentIntent = PendingIntent.getActivity(context, 0, intent,
                PendingIntent.FLAG_UPDATE_CURRENT);

        /*      notification.setLatestEventInfo(context, notficationMessage , message , contentIntent);
              notificationManager.notify(Consts.NOTIFICATION_ID, notification);*/

        NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
                .setSmallIcon(getNotificationIcon()).setContentTitle("").setContentText("");

        Notification n = mBuilder.setContentIntent(contentIntent).setSmallIcon(getNotificationIcon())
                .setTicker("").setWhen(System.currentTimeMillis()).setAutoCancel(true).setContentTitle(title)
                .setStyle(new NotificationCompat.BigTextStyle().bigText(message.replaceAll("[\t\n\r]", "\n")))
                .setContentText(message).build();

        if (isNotificationSoundEnabled()) {
            n.defaults |= Notification.DEFAULT_SOUND;
        }

        if (isNotificationVibrateEnabled()) {
            n.defaults |= Notification.DEFAULT_VIBRATE;
        }
        notificationManager.notify(Consts.NOTIFICATION_ID, n);
        // Notification
    } else {
        Log.w(LOGTAG, "Notificaitons disabled.");
    }
}