【问题标题】:How to open the url as Intent.ACTION_VIEW use only Google Drive?如何打开网址作为 Intent.ACTION_VIEW 仅使用 Google Drive?
【发布时间】:2018-07-31 12:05:20
【问题描述】:

我正在为韩国流行的信使制作一个下载主题的应用程序。这个应用程序显然需要服务器来保存主题文件。我选择服务器作为 Google Drive,因为它的服务是免费且无限制的。当用户点击下载按钮时,App 的下载主题来自 Google Drive 公共链接。如果 URL 作为 Google Drive 应用程序打开,则没有问题。但它使用三星互联网浏览器打开 URL,如上图所示。 Google Drive Code 示例就像这句话,Like this drive.google.com/file/d/FileCode/view?usp=sharing。

我希望用户只使用 GOOGLE 驱动器打开 URL。

public void setThemeDownloadButton(final Context context, final String url) {
    themeBottomDownload.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
        }
    });
}

【问题讨论】:

标签: android android-intent google-drive-android-api android-browser


【解决方案1】:

为特定应用设置包

intent.setPackage("com.google.android.apps.docs");

【讨论】:

  • 你说的是setPackage方法吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-10-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多