1

html5 jquery mobile hybrid phonegap app on android s6 sport using phonegap desktop and phonegap developer app on phone. Not sure of phone gap version (cli not installed properly, tried but opening prompt gives an error) but it is a recent (last week) install.

Using call in chrome opens phone app dialer but not in test phonegap app - click does nothing. Also mailto: and http: acts the same, works in chrome not in app.

The exact html is:

<a id="btn_phone" href="tel:18001231234" rel="external" data-role="button" data-icon="phone"></a>

I added to the config.xml and based on comments removed the catch-all which got it working for others but not in my case.

In config file is this:

<access origin="tel:*" launch-external="yes"/>
<access origin="geo:*" launch-external="yes"/>
<access origin="mailto:*" launch-external="yes"/>
<access origin="sms:*" launch-external="yes"/>
<plugin name="cordova-plugin-whitelist" version="1"/>
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
<allow-intent href="tel:*"/>
<allow-intent href="sms:*"/>
<allow-intent href="mailto:*"/>
<allow-intent href="geo:*"/>

as stated I removed this:

<access origin="*"/>

So based on everything I've read that should be all I need to do but it is still not working.

Two questions:

  1. Does anyone know a fix for this?

  2. Is there a way to debug this on the phone to see what is failing?

thanks

Harshad Pansuriya
  • 20,189
  • 8
  • 67
  • 95
kpg
  • 589
  • 6
  • 28
  • Similar thread. http://stackoverflow.com/questions/26271313/tel-sms-and-mailto-no-longer-working-in-android-after-upgrading-to-cordo – Avijit Feb 21 '16 at 07:35
  • @kpg Please **answer the following questions in your post**. Since this appears to be your first post on this subject. Is this your first hybrid App? Are you using the Desktop App? What is your target platform and their target versions: Android 4,5,6? iOS 7,8,9? What platform are you developing on? Windows, MacOS? Are you using an emulator? Once you have answer the question *in the post*, respond in the comments so I know you have added information to the post. –  Feb 23 '16 at 00:14
  • @kpg is your issue resolved? –  Feb 27 '16 at 05:09
  • very late followup - sorry. I never did get this to work and eventually abandoned phonegap because the learning curve was too steep for the simple app I wanted to create - went with telerik platform instead (not free). – kpg Jan 06 '17 at 17:04

2 Answers2

4

I struggled with this forever and eventually did the following which worked:

In the HTML:

<input type="button" href="tel:+1-800-555-1234“ class="phone-number" value="1-800-555-1234"/>

In the Javascript:

$(‘.phone-number’).bind(click, function(e) {
    e.preventDefault()
    var phoneLink = $(e.currentTarget).attr('href');
    window.open(phoneLink, '_system', 'location=yes’);
}
Dallas Caley
  • 5,367
  • 6
  • 40
  • 69
0

What is your cordova version? I think your problem is the white list plugin declaration.

Try this:

<feature name="Whitelist">
    <param name="android-package" value="YOUR_WHITELIST_CORDOVA_PATH" />
    <param name="onload" value="true" />
</feature>

More info on how to configure White List here: https://www.npmjs.com/package/cordova-plugin-whitelist


NOTE TO ALL This answer does NOT work for CLI. <feature> in this context is meant for SDK and those using an IDE. See Documentation The feature Element
Quote:

If you use the CLI to build applications, you use the plugin command to enable device APIs. This does not modify the top-level config.xml file, so the <feature> element does not apply to your workflow.

If you work directly in an SDK and using the platform-specific config.xml file as source, you use the <feature> tag to enable device-level APIs and external plugins. They often appear with custom values in platform-specific config.xml files.

Community
  • 1
  • 1
Cordovaing
  • 301
  • 1
  • 8
  • 1
    Cordoba ver 6.0. I see that the white list plugin is needed at 4.0 and above, I installed it but still not working but I see now that this is where the problem lies. I just need to have the plugin installed correctly and get the confing.xml right. I'll do more research. The CLI is not working properly so I think I'll start over with a clean install. – kpg Feb 21 '16 at 18:49