Hi Gregory,
Below is the code to accomplish this. Basically, the Corona app will attempt to open the other app by its URL scheme. If the app is installed, it jumps out and opens it. If it’s not installed, it will go to the App Store and prompt for download (or, you can choose to do whatever else… show an error message, silently “fail” and do nothing, whatever).
If you need an “incomplete” reference to common/known URL schemes to define in line 6, you can refer to the list below. I don’t see all of them listed, so you might just try experimenting with what seems logical and testing it out. For example, Skype is not actually listed for some bizarre reason, but typing in “skype://” in the code works for me.
http://wiki.akosma.com/IPhone_URL_Schemes
local button = display.newRect (20,100,200,50)
local function onObjectTouch( self, event )
if event.phase == "began" then
print("opening...")
local isAppInstalled = system.openURL("skype://")
if ( isAppInstalled == false ) then
--open app store for Skype if it is not installed
system.openURL("http://itunes.apple.com/br/app/skype/id304878510?mt=8")
end
end
return true -- IMPORTANT
end
-- begin detecting touches
button.touch = onObjectTouch
button:addEventListener( "touch", button )
Does this answer your question sufficiently?
Best regards,
Brent [import]uid: 200026 topic_id: 35242 reply_id: 140101[/import]