我制作了一个网站的网络视图。现在我想将我的网络视图中的一些数据共享到 Whatsapp 应用程序。我能够打开 Whatsapp 网页,但我的客户希望我打开 Whatsapp 应用程序而不是 Whatsapp 网页。我怎样才能做到这一点?
这就是我在我的网站中打开 Whatsapp 网站所做的操作:
<a class="social-icon whatsapp"
href="javascript:popWin('https://api.whatsapp.com/send?text=Product%20Name:-<?php echo $productName; ?>.%20Product%20link:-<?php echo $productUrl; ?>', 'whatsapp', 'width=640, height=480, left=0, top=0, location=no, status=yes, scrollbars=yes, resizable=yes');"
title="<?php echo $this->__('Share on Whatsapp') ?>"
data-action="share/whatsapp/share">
<span><i class="fa fa-whatsapp"></i></span>
</a>
@Override
public boolean shouldOverrideUrlLoading(WebView wv, String url) {
if(url.startsWith("tel:") || url.startsWith("whatsapp:")) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
return true;
}
return false;
}
将此代码放入您的mWebView.setWebViewClient(new WebViewClient()。它将完美地适用于所有链接,例如tel:, 微信: etc.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)