Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch firefox mobile from another app

I need to launch firefox mobile within my application. I'm currently doing this:

String url = "http://www.google.it";
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setComponent(new ComponentName("org.mozilla.firefox_beta",
    "org.mozilla.firefox_beta.App"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData(Uri.parse(url));
startActivity(intent);

And it works if firefox is not running. While if it is running (paused in background) this code just bring firefox up without loading the url I specified in the code.

like image 733
rops Avatar asked Dec 05 '25 13:12

rops


1 Answers

This works for me:

adb shell am start -a android.intent.action.VIEW -n org.mozilla.firefox_beta/.App -d 'http://www.mozilla.org'

Try changing your:

Intent intent = new Intent(Intent.ACTION_MAIN, null);

to

Intent intent = new Intent(Intent.ACTION_VIEW, null);
like image 125
Mark Finkle Avatar answered Dec 08 '25 05:12

Mark Finkle



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!