Hello,
Welcome to our Microsoft Q&A platform!
First of all, please make sure your “tel:” links type is tel:124568
simple.
Then, please check if you have created a new WebViewClient
. to handle the open the dial operation.
web_view.SetWebViewClient(new HelloWebViewClient(this));
public class HelloWebViewClient : WebViewClient
{
public HelloWebViewClient(MainActivity mainActivity)
{
MainActivity = mainActivity;
}
public MainActivity MainActivity { get; }
public override bool ShouldOverrideUrlLoading(WebView view, IWebResourceRequest request)
{
var uri = view.Url;
if (uri.ToString().StartsWith("tel:"))
{
//Handle telephony Urls
// test ur; var url1 = "tel:124568";
Intent intent = new Intent(Intent.ActionView, Uri.Parse(uri));
MainActivity.StartActivity(intent);
}
else
{
//Handle Web Urls
view.LoadUrl(uri.ToString());
}
return true;
}
}
======================
Update===========================
Please override the ShouldOverrideUrlLoading(WebView view, string url)
use this url directly, it worked as normal
public class HelloWebViewClient : WebViewClient
{
public HelloWebViewClient(MainActivity mainActivity)
{
MainActivity = mainActivity;
}
public MainActivity MainActivity { get; }
public override bool ShouldOverrideUrlLoading(WebView view, string url)
{
// var uri = view.Url;
if (url.ToString().StartsWith("tel:"))
{
//Handle telephony Urls
// test ur; var url1 = "tel:124568";
Intent intent = new Intent(Intent.ActionView, Uri.Parse(url));
MainActivity.StartActivity(intent);
}
else
{
//Handle Web Urls
view.LoadUrl(url.ToString());
}
return true;
}
//public override bool ShouldOverrideUrlLoading(WebView view, IWebResourceRequest request)
//{
// var uri = view.Url;
// if (uri.ToString().StartsWith("tel:"))
// {
// //Handle telephony Urls
// // test ur; var url1 = "tel:124568";
// Intent intent = new Intent(Intent.ActionView, Uri.Parse(uri));
// MainActivity.StartActivity(intent);
// }
// else
// {
// //Handle Web Urls
// view.LoadUrl(uri.ToString());
// }
// return true;
//}
}
Best Regards,
Leon Lu
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.