【发布时间】:2018-10-24 02:37:12
【问题描述】:
我正在逐步关注this tutorial,以便在 Android 上进行深度链接。部分代码如下,基本上会在我的App的webview中打开url。
Intent intent = getIntent();
String action = intent.getAction();
Uri data = intent.getData();
if (data != null) {
String path = data.getPath();
String query = data.getEncodedQuery();
String hash = data.getEncodedFragment();
String fullPath = path;
if(query != null){
fullPath = path + "?" + query;
if(hash != null){
fullPath = path + "#" + hash;
}
}
String openUrl = "https://" + Config.domain + fullPath;
....
// and open in webview
}
它几乎可以完美运行。 Chrome 浏览器上的链接可以在我的应用程序中打开。但是,当点击 Whatsapp 等消息应用程序上的链接时,该链接会在 Whatsapp 本身上打开,方法是替换 Whatsapp 上的原始内容!除非我退出应用程序并再次打开它,否则我无法返回到 Whatsapp 的正常消息屏幕!
为什么会出现这样的行为,我该怎么做才能解决它?谢谢!
【问题讨论】:
标签: android android-studio webview android-webview deep-linking