【发布时间】:2019-12-28 15:39:15
【问题描述】:
我想在点击特定链接时打开我的应用并加载 URL。
这是我处理外部链接的清单。
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="www.android.com" />
<data android:scheme="https" android:host="www.android.com" />
</intent-filter>
处理传入链接的代码
intentData = getIntent().getData();
if(intentData !=null){
loadUrl = intentData.toString();
}else {
loadUrl = "https://www.android.com";
}
webView.loadUrl(loadUrl);
现在,当我从诸如whatsapp 之类的外部应用程序中单击https://www.android.com 时,它已加载到webview 中,但webview 已附加到whatsapp。检查下面的屏幕截图。
如果有人可以在我从谷歌浏览器(在我的手机中)打开 URL(https://www.android.com) 时给我任何提示或指导我如何打开我的应用程序,那将是一个很大的帮助
【问题讨论】:
标签: android webview external-links