How to open the phone dialer?

。_饼干妹妹 提交于 2019-12-04 10:35:17

Are you testing in the iOS Simulator? if so, you must test in a device.
For Android, you can test in either the Emulator or a device.

The following worked for me in an iOS device:

  • <a href="tel:+1-800-555-1234">call this number</a>
    Can be invoked right from the HTML

  • document.location.href = "tel:+375292771265";
    Can be invoked via a function on button tap

As for Android,

Due to security bugs in Cordova (and the fixes made to counter them), to get the above code to work, you need to open native\res\xml\config.xml and perform the following:

 - <access origin="*"/>
 + <access origin="tel:*" launch-external="true"/>

this cordova plugin are use

mx.ferreyra.callnumber 0.0.2 "Cordova Call Number Plugin"

Code

   <ion-fab left bottom>
    <a href="tel:number" class="button" ion-fab color="light">
        <ion-icon name="keypad"></ion-icon>
    </a>
</ion-fab>

If you are using like this <a href="tel:+1-800-555-1234">call this number</a> and you still getting an error saying ERR_UNKNOWN_URL_SCHEME then use cordova-plugin-invokedialer.

cordova-plugin-invokedialer- npm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!