【发布时间】:2016-10-08 08:09:36
【问题描述】:
我在这方面花了很多时间,但无法弄清楚。
我需要在隐身模式下启动 chrome 浏览器。
我的代码:
private void launchBrowser() {
String url = "http://foyr.com";
Intent launchGoogleChrome = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
launchGoogleChrome.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
launchGoogleChrome.setPackage("com.android.chrome");
try {
startActivity(launchGoogleChrome);
} catch (ActivityNotFoundException e) {
launchGoogleChrome.setPackage(null);
startActivity(launchGoogleChrome);
}
}
我找到了几篇关于此的帖子,但找不到解决方案。 here
link 给了我一些关于隐身模式的想法,但我也尝试过。
private void launchBrowser() {
String url = "http://foyr.com";
Intent launchGoogleChrome = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
launchGoogleChrome.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
launchGoogleChrome.setPackage("com.android.chrome");
launchGoogleChrome.putExtra("com.android.chrome.EXTRA_OPEN_NEW_INCOGNITO_TAB", true);
try {
startActivity(launchGoogleChrome);
} catch (ActivityNotFoundException e) {
launchGoogleChrome.setPackage(null);
startActivity(launchGoogleChrome);
}
}
但是 chrome 浏览器没有收到来自应用的任何意图信息。任何人都可以帮助我哪里错了,该怎么办?
【问题讨论】:
-
可能有使用
EXTRA_OPEN_NEW_INCOGNITO_TAB的解决方案,但我认为从 chrome 外部是不可能的 -
是的..是否有任何安卓意图导航到隐身模式?
-
类似的问题早在几年前就已经发布了,甚至没有一位专家可以回答这些问题。我现在很好奇..也许根本没有解决方案。
标签: java android google-chrome