AndreasH AndreasH - 10 days ago 7
Javascript Question

JQuery Mobile app, make a mobile call with HTML 5

I am using JQuery Mobile with Phonegap and I am trying to create a button and when I click it a phone call should be made. I have mad a lot of research for this problem and I have found the following solution

<a href="tel:+123456789">Call</a>


or

<a href="#" onclick="window.open('tel:+123456789', '_blank', 'location=yes');" data-role="button">Call</a>


This solution is working on browsers (is asking me to open Skype) but when I run it on Android with a Samsung Galaxy S2 is not working. It is not doing anything.

I have tried to add to the config.xml file the following permission:

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


but is not working either.
If you have any solution to suggest please do so. Thank you!

Answer

if you are using inappBrowser plugin, you can launch an inappbrowser window with the tel: address :

var refcall = window.open('tel:'+phoneno, '_blank', 'location=no,closebuttoncaption=Home,disallowoverscroll=yes');

you might then notice that when the call ends, you are taken back to a white screen with the tel number written on top. to avoid this, append the below code too :

refcall.addEventListener('loadstop', function(event) {
                    console.log('done initiating call... closing inappbrowser module');
                    refcall.close();
                });

Try and let us know. It worked fine for me.