calling a telephone number
Hi all
Just trying to get the telephone number to launch the call application but not getting any response. any thoughts?
var tel = Titanium.UI.createAlertDialog(
{
title:'Make a call',
message:'would you like to call now?',
buttonNames: ['No thank you','Yes please'],
});
tel.addEventListener('click', function(e){
if (e.index == 1){
var telNum = telephone.url;
var telNumClean = telNum.split(' ').join('');
Titanium.Platform.openURL(telNumClean);
Ti.API.info(telNumClean);
}
});
Thanks
5 Answers
-
Accepted Answer
What does the telNumClean url look like? Is it something like this?
Titanium.Platform.openURL('tel:4043332222');
-
Hi Don
No the UK number look like this: 01332123456 with the space removed.
do I need to add tel:?
Thanks
Mark
-
Spot on! result. Thank you
var telNum = telephone.url; var telNumClean = telNum.split(' ').join(''); Titanium.Platform.openURL('tel:'+telNumClean); Ti.API.info('tel:'+telNumClean);
-
Hello All,
I am able to make a call with this. but after closing the call window, the application restart. it should actually stay in the screen from where I clicked on the tel no. Please helpthanks in advance
-
Now in the new SDK 3.2.2 like this
Ti.Platform.openURL('tel:0046737551861');