Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 短信息中未获取号码,电话中未获取正确号码,但在模拟器中_Android - Fatal编程技术网

Android 短信息中未获取号码,电话中未获取正确号码,但在模拟器中

Android 短信息中未获取号码,电话中未获取正确号码,但在模拟器中,android,Android,我在WebView中尝试过电话和短信。点击后,若我得到包含电话的URL,那个么我将打开电话的呼叫实用程序。然后我得到一个数字,后面跟着字符“N”。一个在短信:我得到手机短信实用程序,但没有号码。在两个URL中,都有一个URL编号 @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { result = false; // for telephone if (url.cont

我在WebView中尝试过电话和短信。点击后,若我得到包含电话的URL,那个么我将打开电话的呼叫实用程序。然后我得到一个数字,后面跟着字符“N”。一个在短信:我得到手机短信实用程序,但没有号码。在两个URL中,都有一个URL编号

@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