简体   繁体   English

手机链接在android APP中不起作用

[英]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. 你好,我在我的网站<a href='tel: 123456789'>1234</a>有此链接,并且我正在将网站转换为android APP,一切正常,但是此tel链接使我webpage not availablewebpage not available拨打电话,而不是将其视为android应用中的链接。

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 ?? 我不知道如何解决此链接问题,我应该使用任何JavaScript或其他工具吗?

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: 不要忘记在<application />标记之前添加权限:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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