Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Launch Firefox from within application

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

like image 861
Leonidas Avatar asked Nov 04 '11 19:11

Leonidas


People also ask

Does Firefox use Android WebView?

Mozilla uses GeckoView to power Firefox for Android, Firefox Reality, Firefox Focus, and other Android apps. GeckoView serves a similar purpose to Android's built-in WebView, but it has its own APIs and is not a drop in replacement.


2 Answers

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));
like image 197
anonynous Avatar answered Sep 24 '22 17:09

anonynous


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);
like image 43
Daniel Avatar answered Sep 22 '22 17:09

Daniel