【问题标题】:How to redirect from webapp to Google drive app如何从 webapp 重定向到 Google Drive 应用
【发布时间】:2018-06-10 09:56:59
【问题描述】:

我正在使用 webapp。我的要求是在浏览时,当我点击 Google drive 文档链接时,该文档必须在 Google drive 应用程序中打开,而不是在我的 webapp 中加载文档

【问题讨论】:

    标签: android webview google-drive-api webapp2


    【解决方案1】:

    这是一个代码 sn-p 用于启动安装在设备上的 google doc 应用程序。

    webview.setWebViewClient(new WebViewClient(){
                @Override
                public boolean shouldOverrideUrlLoading(WebView view, String url) {
                    if (url.contains("doc.google.com")) {
                        view.getContext().startActivity(
                                new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
                        return true;
                    } else {
                        view.loadUrl(url);
                        return true;
                    }
                }
            });
    

    这是启动可以处理谷歌文档的活动/应用程序的最安全方式。

    【讨论】:

      【解决方案2】:

      您是否有权访问文档 ID?如果你这样做了 - 只需在新标签页中打开 https://docs.google.com/open?id=<id>

      【讨论】:

        猜你喜欢
        • 2012-07-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-03-26
        • 1970-01-01
        • 1970-01-01
        • 2019-12-04
        • 1970-01-01
        相关资源
        最近更新 更多