问题描述
亲爱的 我有 Webview 应用程序,但无法打开任何 WhatsApp 链接或电话 我使用以下代码
@Override
public void menuItemClicked(Action action,MenuItem item) {
if (WebToAppWebClient.urlShouldOpenExternally(action.url)){
//Load url outside WebView
try {
startActivity(
new Intent(Intent.ACTION_VIEW,Uri.parse(action.url)));
} catch(ActivityNotFoundException e) {
if (action.url.startsWith("intent://") || (action.url.startsWith("whatsapp:")
|| (action.url.startsWith("tel:")))){
startActivity(
new Intent(Intent.ACTION_VIEW,Uri.parse(action.url.replace("intent://","http://"))));
new Intent(Intent.ACTION_VIEW,Uri.parse(action.url.replace("whatsapp:","http://")));
new Intent(Intent.ACTION_VIEW,Uri.parse(action.url.replace("tel:","http://")));
} else {
Toast.makeText(this,getResources().getString(R.string.no_app_message),Toast.LENGTH_LONG).show();
}
}```
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)