Android: Launch Firefox from within application

后端 未结 2 789
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-05 10:20

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

2条回答
  •  萌比男神i
    2021-01-05 10:55

    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));
    

提交回复
热议问题