Android 短信息中未获取号码,电话中未获取正确号码,但在模拟器中
我在WebView中尝试过电话和短信。点击后,若我得到包含电话的URL,那个么我将打开电话的呼叫实用程序。然后我得到一个数字,后面跟着字符“N”。一个在短信:我得到手机短信实用程序,但没有号码。在两个URL中,都有一个URL编号Android 短信息中未获取号码,电话中未获取正确号码,但在模拟器中,android,Android,我在WebView中尝试过电话和短信。点击后,若我得到包含电话的URL,那个么我将打开电话的呼叫实用程序。然后我得到一个数字,后面跟着字符“N”。一个在短信:我得到手机短信实用程序,但没有号码。在两个URL中,都有一个URL编号 @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { result = false; // for telephone if (url.cont
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
result = false;
// for telephone
if (url.contains("tel:")) {
view.getContext().startActivity(
new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
result = true;
}
// for SMS or message.
if (url.contains("sms:")) {
view.getContext().startActivity(
new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
result = true;
}
Log.d(TAG, url);
return result;
}
对于呼叫实用程序,使用
Intent.ACTION\u拨号
代替Intent.ACTION\u视图
和
对于SMS实用程序,使用“smsto:”原型代替“SMS:”,并使用Intent.ACTION\u SENDTO
代替Intent.ACTION\u VIEW