Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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

— asked April 15th 2010 by Mark Pierce
  • iphone
  • plateform
0 Comments

5 Answers

  • Accepted Answer

    What does the telNumClean url look like? Is it something like this?

    Titanium.Platform.openURL('tel:4043332222');
    
    — answered April 15th 2010 by Don Thorp
    permalink
    0 Comments
  • Hi Don

    No the UK number look like this: 01332123456 with the space removed.

    do I need to add tel:?

    Thanks

    Mark

    — answered April 15th 2010 by Mark Pierce
    permalink
    0 Comments
  • Spot on! result. Thank you

    var telNum = telephone.url;
                             var telNumClean = telNum.split(' ').join('');
                            Titanium.Platform.openURL('tel:'+telNumClean);
                            Ti.API.info('tel:'+telNumClean);
    
    — answered April 15th 2010 by Mark Pierce
    permalink
    0 Comments
  • 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 help

    thanks in advance

    — answered April 10th 2013 by Aamer Zahir
    permalink
    0 Comments
  • Now in the new SDK 3.2.2 like this

    Ti.Platform.openURL('tel:0046737551861');
    
    — answered April 8th 2014 by Mohammed Abunada
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.