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
Asked
Active
Viewed 7,765 times
7
-
Why Firefox specifically? Why not a general "browser" intent? What if the user doesn't have FF? – Matt Ball Nov 04 '11 at 19:38
-
Cant you just launch browser? And on handset if you set Firefox as the default browser, it should be launched. – omermuhammed Nov 04 '11 at 19:38
-
This is for a business sales app, so they will always be run on the same tablet, with the same browser. Right now I have the browser chooser that comes up, but that's kind of annoying and I'd like to streamline it a little further. – Leonidas Nov 04 '11 at 19:39
-
what I've been doing is omermuhammed's suggestion of setting the default browser. – Leonidas Nov 04 '11 at 19:40
2 Answers
10
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));

anonynous
- 116
- 2
- 4
3
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);

Daniel
- 2,371
- 3
- 15
- 14