Software Archive
Read-only legacy content
17061 Discussions

How to dial/call from apk

nicolas_r_
Beginner
419 Views

How to dial/call from apk i want from a button get into the dial of the phone whit a number ready to call.

0 Kudos
2 Replies
PaulF_IntelCorp
Employee
420 Views

There are a variety of solutions, please "google" for "plugin to dial telephone cordova"

0 Kudos
Ed_T_
Beginner
420 Views

Paul,

I know this is a year late, but I was trying to solve the same problem today and your your google advice sent me in just the right direction.

This thread in StackOverflow in particular is a great solution using inappbrowser.

http://stackoverflow.com/questions/19639663/cordova-trying-to-dial-telephone-number

Leads to:

obj.public_phone is a value in a JSON object and the js is creating a string (out for output) that is passed to a <div> in html for display:

 if (obj.public_phone.length > 0){out += 'Call: <br><button class="btn widget uib_w_22 d-margins btn-xs btn-primary" ';
 out += 'data-uib="twitter%20bootstrap/button" data-ver="1" ';
 out += 'onclick= "placeCall(\'' + obj.public_phone + '\')">' + obj.public_phone + '</button><br>';}

later in app.js:

function placeCall(num) {
        cordova.InAppBrowser.open('tel:' + num.replace(/\(|\)|\ |\-/g,''), '_system');
};

Simple, elegant, and uses inappbrowser in a way I would never have thought of. BEAUTIFUL!

Ed

 

 

 

0 Kudos
Reply