简体   繁体   中英

phone link not working in the android APP

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 ??

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" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM