Making call is not working on Android WebView -


i've tried every kind of on google, it's still not working on project.

i'm trying make site "http://dongari.or.kr/handongdae/" android web app, , there's <a href="tel:> tag on website when browser's window has become small size.

when make android web application, phonecall not working though did right way other people guided me do. application keep shows me "this page not available"

asking help!

below code

[mainactivity.java]

package com.example.user.webviewtest;  import android.app.activity; import android.content.intent; import android.net.uri; import android.support.v4.app.fragmentactivity; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.keyevent; import android.webkit.webview; import android.webkit.webviewclient;  import com.google.android.gms.appindexing.action; import com.google.android.gms.appindexing.appindex; import com.google.android.gms.common.api.googleapiclient;  public class mainactivity extends fragmentactivity {      private webview mwebview;     private string mcurrenturl;     /**      * attention: auto-generated implement app indexing api.      * see https://g.co/appindexing/androidstudio more information.      */     private googleapiclient client;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          mwebview = (webview) this.findviewbyid(r.id.webview);          string url = "http://dongari.or.kr/handongdae/";          mwebview.getsettings().setjavascriptenabled(true);         mwebview.loadurl(url);          mwebview.setwebviewclient(new webviewclient() {          });          mcurrenturl = null;         // attention: auto-generated implement app indexing api.         // see https://g.co/appindexing/androidstudio more information.         client = new googleapiclient.builder(this).addapi(appindex.api).build();     }      @override     public void onstart() {         super.onstart();          // attention: auto-generated implement app indexing api.         // see https://g.co/appindexing/androidstudio more information.         client.connect();         action viewaction = action.newaction(                 action.type_view, // todo: choose action type.                 "main page", // todo: define title content shown.                 // todo: if have web page content matches app activity's content,                 // make sure auto-generated web page url correct.                 // otherwise, set url null.                 uri.parse("http://host/path"),                 // todo: make sure auto-generated app deep link uri correct.                 uri.parse("android-app://com.example.user.webviewtest/http/host/path")         );         appindex.appindexapi.start(client, viewaction);     }      @override     public void onstop() {         super.onstop();          // attention: auto-generated implement app indexing api.         // see https://g.co/appindexing/androidstudio more information.         action viewaction = action.newaction(                 action.type_view, // todo: choose action type.                 "main page", // todo: define title content shown.                 // todo: if have web page content matches app activity's content,                 // make sure auto-generated web page url correct.                 // otherwise, set url null.                 uri.parse("http://host/path"),                 // todo: make sure auto-generated app deep link uri correct.                 uri.parse("android-app://com.example.user.webviewtest/http/host/path")         );         appindex.appindexapi.end(client, viewaction);         client.disconnect();     }      private class mywebviewclient extends webviewclient {         @override         public boolean shouldoverrideurlloading(webview view, string url) {              if (url.startswith("tel:")) {                 intent intent = new intent(intent.action_dial, uri.parse(url));                 startactivity(intent);                 return true;             }              if (mcurrenturl != null && url != null && url.equals(mcurrenturl)) {                 mwebview.goback();             } else {                 view.loadurl(url);                 mcurrenturl = url;             }              return true;         }     }      @override     public boolean onkeydown(int keycode, keyevent event) {         if ((keycode == keyevent.keycode_back) && mwebview.cangoback()) {             mwebview.goback();             return true;         }         return super.onkeydown(keycode, event);     } } 

[androidmanifest.xml]

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.example.user.webviewtest">      <uses-permission android:name="android.permission.internet"/>     <uses-permission android:name="android.permission.call_phone" />     <uses-permission android:name="android.permission.dial_phone" />      <application         android:allowbackup="true"         android:icon="@mipmap/ic_launcher"         android:label="@string/app_name"         android:supportsrtl="true"         android:theme="@android:style/theme.notitlebar">          <activity android:name=".mainactivity">             <intent-filter>                 <action android:name="android.intent.action.main" />                  <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>         <!-- attention: auto-generated add google play services project              app indexing.  see https://g.co/appindexing/androidstudio more information. -->         <meta-data             android:name="com.google.android.gms.version"             android:value="@integer/google_play_services_version" />     </application>  </manifest> 

you should return false

this work fine you:

private class mywebviewclient extends webviewclient {         @override         public boolean shouldoverrideurlloading(webview view, string url) {              if (url.startswith("tel:")) {                 intent intent = new intent(intent.action_dial, uri.parse(url));                 startactivity(intent);                 return true;             }             return false;         }     } 

Comments