Does anyone know how to make a phone call when a button is touched???

  1. Does anyone know how to make a phone call when a button is touched???
    I need this to be supported on IOS+ANDROID…

2.How can i check it?? (i know that simulator doesnt make calls) [import]uid: 168570 topic_id: 30887 reply_id: 330887[/import]

Try something like this:

  
callButton = display.newImageRect("callbutton.png", 128,64)  
callButton.phoneNumber = "1-555-555-5555"  
local function makeCall(event)  
 if event.phase == "ended" then  
 system.openURL("tel:" .. event.target.phoneNumber)  
 end  
 return true -- important, don't leave out  
end  
callButton:addEventListener("touch", makeCall)  

[import]uid: 19626 topic_id: 30887 reply_id: 123525[/import]

thanks rob! can i modify this code for sending email or opening a web page?? [import]uid: 168570 topic_id: 30887 reply_id: 123656[/import]

You can open a web page that way, it will launch safari instead of showing it in your app.

URL’s of “mailto:someone@somewhere.com” will open the email application to send email, but again, you leave your app to do so.

Corona offers ways to do email and webpages as part of your app so you’re not leaving it.

See native.newWebView: http://docs.coronalabs.com/api/library/native/newWebView.html
and native.showPopup: http://docs.coronalabs.com/api/library/native/showPopup.html [import]uid: 19626 topic_id: 30887 reply_id: 123674[/import]

nice… and what about OS ? are these supported on both IOS + ANDROID??
What about simulators? i think they dont support these features… how can i test these?? [import]uid: 168570 topic_id: 30887 reply_id: 123792[/import]

Try something like this:

  
callButton = display.newImageRect("callbutton.png", 128,64)  
callButton.phoneNumber = "1-555-555-5555"  
local function makeCall(event)  
 if event.phase == "ended" then  
 system.openURL("tel:" .. event.target.phoneNumber)  
 end  
 return true -- important, don't leave out  
end  
callButton:addEventListener("touch", makeCall)  

[import]uid: 19626 topic_id: 30887 reply_id: 123525[/import]

thanks rob! can i modify this code for sending email or opening a web page?? [import]uid: 168570 topic_id: 30887 reply_id: 123656[/import]

You can open a web page that way, it will launch safari instead of showing it in your app.

URL’s of “mailto:someone@somewhere.com” will open the email application to send email, but again, you leave your app to do so.

Corona offers ways to do email and webpages as part of your app so you’re not leaving it.

See native.newWebView: http://docs.coronalabs.com/api/library/native/newWebView.html
and native.showPopup: http://docs.coronalabs.com/api/library/native/showPopup.html [import]uid: 19626 topic_id: 30887 reply_id: 123674[/import]

nice… and what about OS ? are these supported on both IOS + ANDROID??
What about simulators? i think they dont support these features… how can i test these?? [import]uid: 168570 topic_id: 30887 reply_id: 123792[/import]