just wondering if anyone know the correct intent to launch Firefox's Mobile Browser. I can't find it anywhere, so I was hoping someone here would know. Thanks
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
This will create an intent for Firefox:
String url = "http://example.com/";
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setComponent(new ComponentName("org.mozilla.firefox", "org.mozilla.firefox.App"));
intent.setAction("org.mozilla.gecko.BOOKMARK");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("args", "--url=" + url)
intent.setData(Uri.parse(url));
回答2:
Try this code:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.setComponent(new ComponentName("org.mozilla.firefox", "org.mozilla.firefox.App"));
this.startActivity(intent);