在android中打开Xiomi本机浏览器?

时间:2018-02-26 09:50:43

标签: java android

如何在android中以编程方式打开xiomi(Mi Note 4浏览器)本机浏览器。我能够打开chrome浏览器。这里我代码为chrome

Intent browserIntent = new Intent(
                    "android.intent.action.VIEW");
browserIntent
                    .addCategory("android.intent.category.LAUNCHER");
browserIntent
                    .addCategory("android.intent.category.BROWSABLE");
browserIntent.putExtra("create_new_tab", false);

browserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

browserIntent.setData(Uri.parse("www.google.com"));
// browserIntent.setType("text/html");
browserIntent.setClassName("com.sec.android.app.sbrowser",
                            "com.sec.android.app.sbrowser.SBrowserMainActivity");

browserIntent.putExtra(
                    "com.android.browser.application_id",
                    "com.sec.android.app.sbrowser");

// browserIntent.setFlags(32768);
startActivity(browserIntent);

1 个答案:

答案 0 :(得分:0)

您可以尝试添加com.android.browser作为包并删除类名方法吗?

Intent browserIntent = new Intent("android.intent.action.VIEW");
browserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
browserIntent.setData(Uri.parse("www.google.com"));
browserIntent.setPackage("com.android.browser");
startActivity(browserIntent);