With system.openURL() you are able to open and switch to other apps thru the uri-schema used in the url.
According to the comment here (http://developer.anscamobile.com/content/configuring-projects#comment-32522), I was hoping to do the same thing the other way around: by configuring my app such that it registers a uri-schema in the config.build plist, I could start myapp from within a webpage/email/tweet/etc.
Unfortunately, I cannot make it work… The config.build file that I use is:
[lua]settings = {
orientation = {
default =“portrait”,
content = “portrait”,
supported = {
“portrait”
},
},
iphone = {
plist = {
UIApplicationExitsOnSuspend = false,
CFBundleURLTypes = {
CFBundleURLName = “com.creativeapptitude.swimtimer”,
CFBundleURLSchemes = {
“swimtimer”,
},
},
},
}
}[/lua]
Is this feature of custom urls supported by CoronaSDK?
Did anyone manage to get it to work?
Anything wrong with by build.config file?
And if it is supported… can I somehow get access to the complete url that was used to start myapp?
Appreciate any help, Frank.
[import]uid: 8093 topic_id: 9647 reply_id: 309647[/import]
Sorry - got it to work already - needed one more level of nesting in the plist - correct build.settings is:
[lua]settings = {
orientation = {
default =“portrait”,
content = “portrait”,
supported = {
“portrait”
},
},
iphone = {
plist = {
UIApplicationExitsOnSuspend = false,
CFBundleURLTypes = {
{
CFBundleURLName = “com.creativeapptitude.swimtimer”,
CFBundleURLSchemes = {
“swimtimer”,
},
},
},
},
}
}[/lua]
Thanks, Frank.
[import]uid: 8093 topic_id: 9647 reply_id: 35145[/import]
I was able to get the custom URL to work great using your example. How do we pass-in variables? For instance, I want to send it a variable called “yournumber” to it with the value ‘5’
Any suggestions?
[import]uid: 111302 topic_id: 9647 reply_id: 98132[/import]
Figure it out from another thread:
– code below
local launchArgs = …
local launchURL = “n/a”
local function printURL( url )
local myText = display.newText( "DATA: " … launchURL , 0, 0, native.systemFont, 18 )
myText.x = display.contentWidth / 2
myText.y = 200
myText:setTextColor( 255,110,110 )
end
if launchArgs and launchArgs.url then
launchURL = launchArgs.url
printURL( launchURL)
end
local function onSystemEvent( event )
if event.type == “applicationOpen” and event.url then
launchURL = event.url
printURL( launchURL)
end
end
Runtime:addEventListener( “system”, onSystemEvent ) [import]uid: 111302 topic_id: 9647 reply_id: 98148[/import]