hello i have this link in my website <a href='tel: 123456789'>1234</a> and i am converting the website into android APP everything works fine but this tel link gives me webpage not available how can i make this to call the phone instead of treating this as a link in android app.

i have already added

<uses-permission android:name="android.permission.CALL_PHONE" /> 

i dont know how to fix this link issue should i use any javascript or something ??

3

1 Answer

With what I understand, you want to call the number when someone clicks it, you can use this code:

String uri = "tel:" + "NUMBER-GOES-HERE" ; Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse(uri)); startActivity(intent); 

Don't forget to add permission before the <application /> tag:

<uses-permission android:name="android.permission.CALL_PHONE" /> 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.