从另一个应用程序启动firefox mobile

rop*_*ops 3 firefox android fennec

我需要在我的应用程序中启动firefox mobile.我现在正在这样做:

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);
Run Code Online (Sandbox Code Playgroud)

如果firefox没有运行它会工作.如果它正在运行(在后台暂停),这段代码只需启动firefox而不加载我在代码中指定的url.

小智 8

这对我有用:

adb shell am start -a android.intent.action.VIEW -n org.mozilla.firefox_beta/.App -d 'http://www.mozilla.org'
Run Code Online (Sandbox Code Playgroud)

尝试更改你的:

Intent intent = new Intent(Intent.ACTION_MAIN, null);
Run Code Online (Sandbox Code Playgroud)

Intent intent = new Intent(Intent.ACTION_VIEW, null);
Run Code Online (Sandbox Code Playgroud)