【问题标题】:How to launch Chrome app from android native app如何从 Android 原生应用启动 Chrome 应用
【发布时间】:2019-04-01 14:01:47
【问题描述】:

我想知道有什么方法可以通过安装在同一设备上的 android 应用程序启动安装在 Chromebook 上的 chrome 应用程序(不是 chrome 浏览器应用程序),android 应用程序是 apk。

【问题讨论】:

    标签: android google-chrome google-chrome-app chromebook


    【解决方案1】:

    试试这个解决方案

    String urlString = "http://mysuperwebsite";
    Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(urlString));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setPackage("com.android.chrome");
    try {
      context.startActivity(intent);
    } catch (ActivityNotFoundException ex) {
    // Chrome browser presumably not installed so allow user to choose instead
    intent.setPackage(null);
    context.startActivity(intent);
    

    }

    您指定要打开的网址,此代码将检查 chrome 是否可用,如果不可用,它将让您选择可以使用的其他浏览器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-27
      • 1970-01-01
      相关资源
      最近更新 更多