【发布时间】:2018-06-10 09:56:59
【问题描述】:
我正在使用 webapp。我的要求是在浏览时,当我点击 Google drive 文档链接时,该文档必须在 Google drive 应用程序中打开,而不是在我的 webapp 中加载文档
【问题讨论】:
标签: android webview google-drive-api webapp2
我正在使用 webapp。我的要求是在浏览时,当我点击 Google drive 文档链接时,该文档必须在 Google drive 应用程序中打开,而不是在我的 webapp 中加载文档
【问题讨论】:
标签: android webview google-drive-api webapp2
这是一个代码 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;
}
}
});
这是启动可以处理谷歌文档的活动/应用程序的最安全方式。
【讨论】:
您是否有权访问文档 ID?如果你这样做了 - 只需在新标签页中打开 https://docs.google.com/open?id=<id>。
【讨论】: