Sundar Sundar - 23 days ago 12
iOS Question

Required changes for Ionic 2 call,sms and mailto functionalities in config.xml file?

I have the following codes to invoke the android mobile sms and phone call activity

To send an SMS

<ion-item-options side="left">
<a ion-button [href]="sanitize('sms:'+ user.mobile_no)"><ion-icon name="text"></ion-icon> Text</a>
<a ion-button href="tel:{{user.mobile_no}}"><ion-icon></ion-icon> Call</a>
</ion-item-options>


Sanitize function implemented properly there is no error exits.

Another Approach

<button ion-button (click)="callMe(user)">{{user.mobile_no}}</button>


Component Code

public callMe(user) {
document.location.href = 'tel:'+user.mobile_no;
}


All are not working.

I didn't do any changes on config.xml file. Is I have to update anything else to send an email, call or sms?

My Config XML look like this

<author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html"/>
<access origin="*"/>
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
<allow-intent href="tel:*"/>
<allow-intent href="sms:*"/>
<allow-intent href="mailto:*"/>
<allow-intent href="geo:*"/>
<platform name="android">
<allow-intent href="market:*"/>
<preference name="android-targetSdkVersion" value="19"/>
<preference name="android-minSdkVersion" value="19"/>
</platform>
<platform name="ios">
<allow-intent href="itms:*"/>
<allow-intent href="itms-apps:*"/>
</platform>

Answer

I tried developing in windows and build is generating in Ubuntu. Hence the plugin installation is not proper.

So I executed the following commands to add the plugin again then it works fine.

cordova plugin add cordova-plugin-whitelist
cordova prepare