Ionic系列——調用系統電話

一、需求描述

    在ionic項目用調用手機的打電話功能。開始還想找cordova和ng-cordova的插件那,如今H5實現起來特別方便。html

二、準備

    在cordova中全部的URL Schemes 都是服從於白名單的,因此要如今項目config.xml中添加android

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

    Making a Phone Call from Within PhoneGap in Android and iOS ios

三、代碼實現

    ①html代碼直接寫就能夠了安全

<a href="tel:15210203452">打電話</a>
<a href="tel:10086">打10066</a>

    ②在controller中實現也就一句話app

$scope.callPhone=function(){
    $window.location.href="tel:10085";
}

四、擴展閱讀

   ① iOS的實現須要藉助插件,具體參照連接資料。
    http://rickluna.com/wp/2012/02/making-a-phone-call-from-within-phonegap-in-android-and-ios/ionic

    ②手持移動端特殊連接:打電話,發短信,發郵件ide


五、URL Schemes

這個東西貌似直接用的話只能在ios中用ui

如何找到軟件的URL Schemes?url

http://www.zhihu.com/question/19907735spa

自定義URL scheme for iOS與Android

可是在AIR apps中用自定義URL schemes調用別的apps是不容許的,AIR的安全模型對於schemes在http:,sms:,tel: ,mailto:, file:  ,app:  ,app-storage: ,vipaccess:和connectpro:中的限制是很嚴格的。


ios

http://jbguide.me/2015/03/21/launcher/


android

http://www.360doc.com/content/14/0901/16/9200790_406290994.shtml

http://www.w3chtml.com/html/url.html

相關文章
相關標籤/搜索