Page 1 of 1

How to make a button for phone calls, with numbers coming from the database?

Posted: Wed Aug 20, 2014 2:00 pm
by Rafael Marques

How to make a button for phone calls, with numbers coming from the database?

My biggest problem is I have to do to run the app in android and apple, and the codes for the function are different, as I do?

Can you help me?


How to make a button for phone calls, with numbers coming from the database?

Posted: Wed Aug 20, 2014 2:50 pm
by Evgene Karachevtsev

Hello Rafael,

Please look at this link, it should help: http://stackoverflow.com/questions/41...


How to make a button for phone calls, with numbers coming from the database?

Posted: Wed Aug 20, 2014 5:40 pm
by Rafael Marques

as I do in case the application is made for android and apple?

I add the two codes at once?

window.location.href = 'tel:' + localStorage.getItem ('botaotel');

window.open ('tel:' + localStorage.getItem ('botaotel'), '_SYSTEM');


How to make a button for phone calls, with numbers coming from the database?

Posted: Wed Aug 20, 2014 7:14 pm
by Evgene Karachevtsev

Rafael,

You should use one code to export project for Android and other code for IOS: http://devcenter.appery.io/documentat...


How to make a button for phone calls, with numbers coming from the database?

Posted: Wed Apr 22, 2015 8:47 am
by She

Hi,

Im trying to do this but nothings happen.this was installed to the 5 devices, the version is 4.0.1,4.1.x,4.0.4
this is the the code

window.location.href='tel:'+ localStorage.getItem('ContactNum');

and i was expecting that after clicking the button, the app will go to the "PHONE DIAL":
Image

you will see this in : https://blog.appery.io/2014/03/dialin...

when i tap the button/click nothings happen.
the localStorage variable has a value +639266977xxx


How to make a button for phone calls, with numbers coming from the database?

Posted: Thu Apr 23, 2015 1:11 am
by She

I used the code:

window.open('tel:'+ localStorage.getItem('ContactNum'));

instead of

window.location.href='tel:'+ localStorage.getItem('ContactNum');


How to make a button for phone calls, with numbers coming from the database?

Posted: Thu Apr 23, 2015 2:10 am
by She

Hi Team,
INVALID RECIPIENT always every time i clicked the button
i already triend the following codes:

1.
var cnum = localStorage.getItem("ContactNum");
window.open("sms:"+cnum+"?body"+"You are not logged in.","_system");
2.
var cnum = localStorage.getItem("ContactNum");
window.open("sms:"+cnum+"?body=You are not logged in.");


How to make a button for phone calls, with numbers coming from the database?

Posted: Thu Apr 23, 2015 2:35 am
by She

I investigate the problem and i think the problem is everytime i tried to launch the following codes there are spaces outside the number screenshot is in below:
Image

and i already try to trim it by the following code:
code
var cnum = localStorage.getItem("ContactNum");
var strSMS ='sms:'+cnum;
var body = '?body=You are not logged in.';
var str = strSMS+body;
window.open(str.trim());
console.log(str.trim());
/code
but no luck, any advice?

Thank you,


How to make a button for phone calls, with numbers coming from the database?

Posted: Thu Apr 23, 2015 5:01 am
by She

this is the screenshot after clicking the button:

Image

its hows INVALID RECIPIENT.,


How to make a button for phone calls, with numbers coming from the database?

Posted: Mon Apr 27, 2015 11:21 pm
by Yurii Orishchuk

Hi She,

I guess you have incorrect value in your "" local storage.

Please try following JS code:

pre

var cnum = "+375292771265";//localStorage.getItem("ContactNum");
var strSMS ='sms:'+cnum;
var body = '?body=You are not logged in.';
var str = strSMS+body;
window.open(str.trim(), "_system");
console.log(str.trim());

/pre

I've checked this code on my android device and it works correctly.

Regards.