Launching Application and passing Information to it via custom URL Scheme

Hi,

Is it possible (or can you make it possible) to launch a Corona App from Safari, Mail, etc… via a custom url scheme while passing information to it.

On iOS natively this seems to be very easy, just adding a couple of lines to the info.plist

CFBundleURLTypes  
   
 CFBundleURLSchemes  
   
 myapp  
   
 CFBundleURLName  
 com.yourcompany.myapp  

and implementing a message handler

- (BOOL)application:(UIApplication \*)application handleOpenURL:(NSURL \*)url  
{  
 if (!url) { return NO; }  
   
 NSString \*URLString = [url absoluteString];  
 [[NSUserDefaults standardUserDefaults] setObject:URLString forKey:@"url"];  
 [[NSUserDefaults standardUserDefaults] synchronize];  
 return YES;  
}  

Then one would be able to call the app from anywhere (FB, Twitter, …) just via:

myapp://?foo=1&bar=2  

There is a great tutorial how to achieve this with Objective-C and XCode for iOS-Systems, which I am exclusively interested in right now:
http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

I’m having a great prototype and this feature could make the difference between an average selling and a viral app.

Cheers,
Kai [import]uid: 36753 topic_id: 8325 reply_id: 308325[/import]

Sorry for reposting, but the edit function just did not work for me (I could not select a forum to post in). However I just wanted to add that I know about the plist-table in the build.settings file. However, the keys that are used to create a custom url scheme consist out of nested arrays of dictionaries and I don’t know what equivalent lua-structure your parser would expect for this. Also the passing of the string following the myapp:// is crucial, it does not have to be parsed. [import]uid: 36753 topic_id: 8325 reply_id: 30028[/import]

look at

CFBundleURLTypes


CFBundleURLName
My test URL
CFBundleURLSchemes

mytesturl


and http://developer.anscamobile.com/content/configuring-projects [import]uid: 24 topic_id: 8325 reply_id: 30035[/import]

Hi carlos,

this involves creating a nested array of arrays of dictionary keys, which I tried for 2hrs last night. Seanh just told me on the IRC-channel (which is great btw!!! :slight_smile: ) that there might be some bug preventing nested tables within the iphone.plist to be parsed correctly.

And a very crucial feature would then be exposing the callback function which receives the values following myapp://URL, like this:

- (BOOL)application:(UIApplication \*)application handleOpenURL:(NSURL \*)url   
{  
 // Turn the string into the parameter   
 // of a system or application event and   
 // expose it to the corona users  
}  

Cheers,
Kai [import]uid: 36753 topic_id: 8325 reply_id: 30037[/import]

i’ve opened the event portion of this request as case 4452 [import]uid: 3 topic_id: 8325 reply_id: 30053[/import]

Edit: With the new 2011.484 release, creating nested tables within the info.plist are working fine :slight_smile: Now it is possible to create your own url scheme by adding the following to your build.settings:

 iphone =  
 {  
 plist =  
 {  
 CFBundleURLTypes = {  
 {  
 CFBundleURLName = "com.yourcompany.yourapp",  
 CFBundleURLSchemes = {  
 "yourapp",  
 },  
  
 },  
 },  
  
 }  
 }  

I also posted this snippet as comment on http://developer.anscamobile.com/content/configuring-projects since I guess some users might like this feature in its current state already.

Theoretically it would now be possible to also send information to your app via the link itself, e.g. yourapp://initlevel=4, but the native interface is not yet exposed to the Corona user base. What about the plans to change that?

Cheers,
Kai [import]uid: 36753 topic_id: 8325 reply_id: 30185[/import]

@seanh What ever happened to case 4452 re. the event portion of the URL scheme callback function? I can’t see any reference to it on the bug base.

Stefan [import]uid: 2646 topic_id: 8325 reply_id: 37404[/import]

Any support for android apps to do this?

Using the intent filter android apps should be able to do this also:

<intent-filter><br> <data android:scheme="http" android:host="twitter.com"></data><br> <action android:name="android.intent.action.VIEW"></action><br></intent-filter>  

[import]uid: 13209 topic_id: 8325 reply_id: 37529[/import]

Are there any updates to full two way Custom URL capabilities. Allowing Corona users to access the full Custom URL an application was launched with is a highly important element of mobile development. I can no longer find any reference to case 4452 which sounds like it was regarding this issue… [import]uid: 64692 topic_id: 8325 reply_id: 40983[/import]

I would also very much like to see this feature implemented in corona ( case #4452 ) [import]uid: 13632 topic_id: 8325 reply_id: 66678[/import]