Search This Blog

Thursday 10 December 2015

Enabling click to call and mail in android using ionic/cordova

by default in android tel and mailto are blocked in cordova/ionic.

to enable click to call/mail feature you can use one of below ways:

Option 1:

a. Install whitelist cordova plugin
       ionic plugin install cordova-plugin-whitelist
b.add the below lines to config.xml of your project
   <access origin="tel:*" launch-external="yes" />
   <access origin="mailto:*" launch-external="yes" />
now when you give your phone the below way, it will copy the number to dailing pad.
      <a href="tel:{{Contact.phone}}" style="margin-top: 10px;" class="button icon-left ion-ios-        telephone">{{Contact.phone}}</a>

Option 2:


$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|sip|chrome-extension):/);

add it in the app.js, dont forget to add $compileProvide dependency.

1 comment: