Software Archive
Read-only legacy content
17061 Discussions

How to realize phone call now?

A_B_3
Beginner
644 Views

In older XDK releases I used such JS code:

var phonenumber = "+71234567890";
window.location.href = "tel:" + phonenumber;

and it worked perfect.
Now It is not work. How to realize phone call now? (I build only IOS version)

0 Kudos
3 Replies
Nicolas_O_Intel
Employee
644 Views

Hello A.B

Here is a nice article about how to make phone call from the Ionic Forums https://forum.ionicframework.com/t/making-phone-call-from-app-href-tel-123/1968/13

It show some Ionic specific code there, but it should work with standard HTML code as well. 

0 Kudos
PaulF_IntelCorp
Employee
644 Views

Probably needs some whitelist rules, see this doc page > https://software.intel.com/en-us/xdk/docs/using-cordova-whitelist-rules-with-intel-xdk

0 Kudos
A_B_3
Beginner
644 Views

Yes! I did it.
Thanks for your links.

 

For dummies like me - do these actions:

1. In index.html add:
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-eval' data: blob: filesystem: ws: gap: file: cdvfile: https://ssl.gstatic.com *; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'; img-src * data: 'unsafe-inline'; connect-src * 'unsafe-inline'; child-src *; ">

 

 2. In Project tab - Build settings - Whitelist add: tel:* in Intent (<allow-intent>) and in Navigation (<allow-navigation>)
 

0 Kudos
Reply