Example usage for android.content Intent FLAG_ACTIVITY_NO_HISTORY

List of usage examples for android.content Intent FLAG_ACTIVITY_NO_HISTORY

Introduction

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

Prototype

int FLAG_ACTIVITY_NO_HISTORY

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

Click Source Link

Document

If set, the new activity is not kept in the history stack.

Usage

From source file:com.onesignal.OneSignal.java

private static boolean openURLFromNotification(Context context, JSONArray dataArray) {
    int jsonArraySize = dataArray.length();

    boolean urlOpened = false;

    for (int i = 0; i < jsonArraySize; i++) {
        try {/* ww  w  .ja  v a  2s . c  o m*/
            JSONObject data = dataArray.getJSONObject(i);
            if (!data.has("custom"))
                continue;

            JSONObject customJSON = new JSONObject(data.getString("custom"));

            if (customJSON.has("u")) {
                String url = customJSON.getString("u");
                if (!url.contains("://"))
                    url = "http://" + url;

                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
                        | Intent.FLAG_ACTIVITY_MULTIPLE_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
                context.startActivity(intent);
                urlOpened = true;
            }
        } catch (Throwable t) {
            Log(LOG_LEVEL.ERROR,
                    "Error parsing JSON item " + i + "/" + jsonArraySize + " for launching a web URL.", t);
        }
    }

    return urlOpened;
}

From source file:org.wso2.emm.system.service.EMMSystemService.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void enableHardLock() {
    String message = context.getResources().getString(R.string.txt_lock_activity);
    if (appUri != null && !appUri.isEmpty()) {
        message = appUri;/* ww  w.  j a  v a2s. co  m*/
    }
    if (SettingsManager.isDeviceOwner()) {
        devicePolicyManager.setLockTaskPackages(cdmDeviceAdmin, AUTHORIZED_PINNING_APPS);
        Intent intent = new Intent(context, LockActivity.class);
        intent.setFlags(
                Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
                        | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
        intent.putExtra(Constants.ADMIN_MESSAGE, message);
        intent.putExtra(Constants.IS_LOCKED, true);
        context.startActivity(intent);
    } else {
        Log.e(TAG, "Device owner is not set, hence executing default lock");
        devicePolicyManager.lockNow();
    }
}

From source file:org.mozilla.gecko.GeckoApp.java

void showTabs() {
    Intent intent = new Intent(mAppContext, TabsTray.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    startActivity(intent);/*from ww w  .j av  a 2  s.  co m*/
    overridePendingTransition(R.anim.grow_fade_in, 0);
}

From source file:com.mitre.holdshort.MainActivity.java

private void contactMITRE(String subject) {

    final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.setType("plain/text");
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "ripple@mitre.org" });
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
    emailIntent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    startActivity(Intent.createChooser(emailIntent, "Send mail..."));
}

From source file:com.partypoker.poker.engagement.reach.EngagementReachAgent.java

/** Show content activity */
private void showContent(EngagementReachContent content) {
    /* Update state */
    mState = State.SHOWING;//from   w  ww  .  j  a va 2s . co  m
    mCurrentShownContentId = content.getLocalId();

    /* Start activity */
    Intent intent = content.getIntent();
    filterIntentWithCategory(intent);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY);
    mShowingActivity = intent.getComponent();
    mContext.startActivity(intent);
}

From source file:org.xingjitong.LinphoneActivity.java

public void startActivityForResult(String phone) {
    Intent intent = new Intent(this, InCallActivity2.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    intent.putExtra("phone", phone);
    startActivity(intent);/*from  w w  w .j av  a  2  s . c o  m*/
}

From source file:org.mozilla.gecko.GeckoApp.java

public boolean showAwesomebar(AwesomeBar.Type aType) {
    Intent intent = new Intent(getBaseContext(), AwesomeBar.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_NO_HISTORY);
    intent.putExtra(AwesomeBar.TYPE_KEY, aType.name());

    if (aType != AwesomeBar.Type.ADD) {
        // if we're not adding a new tab, show the old url
        Tab tab = Tabs.getInstance().getSelectedTab();
        if (tab != null) {
            Tab.HistoryEntry he = tab.getLastHistoryEntry();
            if (he != null) {
                intent.putExtra(AwesomeBar.CURRENT_URL_KEY, he.mUri);
            }/*from   ww  w  . j  av  a2s  . c  o  m*/
        }
    }
    mOwnActivityDepth++;
    startActivityForResult(intent, AWESOMEBAR_REQUEST);
    return true;
}