Can we test for URI schemes in Lua / can we add the ability to?

My Objective-C skills are bleh.

Can we test for a particular URI scheme in Corona? I’m admittedly a fan of Chrome for iOS and I like their implementation for testing if Google Chrome is installed by testing the validity of the URI scheme, and if so, launch the URL in Chrome instead of Safari. This could be useful for opening other Corona apps and passing parameters to it, so I’m hoping it can be implemented rather easily in an upcoming build.

Please see https://developers.google.com/chrome/mobile/docs/ios-links for the full post, but this is the current code to test:

[code][[UIApplication sharedApplication] canOpenURL:
[NSURL URLWithString:@“googlechrome://”]];[code]

and how to implement it and convert the URL for Chrome iOS compatibility:

NSURL \*inputURL = <the url to open>;<br>NSString *scheme = inputURL.scheme;<br><br>// Replace the URL Scheme with the Chrome equivalent.<br>NSString *chromeScheme = nil;<br>if ([scheme isEqualToString:@"http"]) {<br> chromeScheme = @"googlechrome";<br>} else if ([scheme isEqualToString:@"https"]) {<br> chromeScheme = @"googlechromes";<br>}<br><br>// Proceed only if a valid Google Chrome URI Scheme is available.<br>if (chromeScheme) {<br> NSString *absoluteString = [inputURL absoluteString];<br> NSRange rangeForScheme = [absoluteString rangeOfString:@":"];<br> NSString *urlNoScheme =<br> [absoluteString substringFromIndex:rangeForScheme.location];<br> NSString *chromeURLString =<br> [chromeScheme stringByAppendingString:urlNoScheme];<br> NSURL *chromeURL = [NSURL URLWithString:chromeURLString];<br><br> // Open the URL with Chrome.<br> [[UIApplication sharedApplication] openURL:chromeURL];<br>} [import]uid: 6084 topic_id: 28601 reply_id: 328601[/import]

+1

+1

+1  thanks !! we need more of this basics.

we get to much extra stuff (like corona cards)

but missing lots of basic things (for example standart Android Widgets… many users like to see app infos on their mainscreen)
 

+1  thanks !! we need more of this basics.

we get to much extra stuff (like corona cards)

but missing lots of basic things (for example standart Android Widgets… many users like to see app infos on their mainscreen)