hash key “#” stripped from ussd code in “tel:” links on html pages

 ̄綄美尐妖づ 提交于 2019-11-30 20:12:14

Use URL encoding for special character in a URL. For example # equals %23

This worked for me:

<a ng-href="tel:%23 224">#224</a>

As you can see:

You need to use Uri.encode("#") For example String number = "tel:*111*2" + Uri.encode("#");

Try this way,hope this will help you to solve your problem.

 webview = (WebView) findViewById(R.id.webview);
 webview.loadData("<a href=\"tel:*111*2#\" class=\"phoneCallButtonLink\">*CLICK HERE AND CALL *111*2#</a>","text/html", "utf-16");
 webview.setWebViewClient(new CustomWebViewClient());

 private class CustomWebViewClient extends WebViewClient {
    @Override
    public boolean shouldOverrideUrlLoading(WebView wv, String url) {
    if(url.startsWith("tel:")) {
       Intent intent = new Intent(Intent.ACTION_DIAL);
       intent.setData(Uri.parse(url.replace("#","%23")));
       startActivity(intent);
       return true;
    }
    return false;
   }
 }

You can use below way to display the USSD in dialer

<a href="tel:*111*2%23" class="phoneCallButtonLink">*CLICK HERE AND CALL *111*2#</a>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!