How to open an URL in PRIVATE TAB (Incognito Browsing) from other android app
Asked Answered
M

1

9

To open an URL in a browser from other android app is simple:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://stackoverflow.com"));
startActivity(intent);

In this way, however, the URL always opens in NORMAL TAB in android browser.


What can I do to open an URL in PRIVATE TAB or INCOGNITO MODE from other android app?

Melaniemelanin answered 29/6, 2013 at 23:33 Comment(0)
B
-5

Add flag= FLAG_ACTIVITY_NO_HISTORY

Intent yourIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(yourUrl));
yourIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
context.startActivity(yourIntent);
Boney answered 3/7, 2013 at 9:35 Comment(1)
This is incorrect. FLAG_ACTIVITY_NO_HISTORY only removes the activity from the history (so that the hardware back-button doens't remember it.Aboriginal

© 2022 - 2024 — McMap. All rights reserved.