App URL Scheme

Hello,

in iOS is possible to open your app with an URL Scheme. For example if you have Facebook and your facebook app id is 123456789101112  you can open your app with a scheme like this:

CFBundleURLTypes = { { CFBundleURLSchemes = { "fb123456789101112", } } }

So if you click on a link like  fb123456789101112://auth/whatever  your iOS Device open your app.

This is possible in Android too using  intent-filter into AndroidManifest.xml

Facebook for example require this code in AndroidManifest.xml

\<activity android:name="com.facebook.LoginActivity"\> \<intent-filter\> \<action android:name="android.intent.action.VIEW" /\> \<category android:name="android.intent.category.DEFAULT" /\> \<category android:name="android.intent.category.BROWSABLE" /\> \<data android:scheme="fb123456789101112" android:host="authorize" /\> \</intent-filter\> \</activity\>

You can absolutely do this without Corona support using apktool to decrypt, modify and encrypt again your apk, but intent-filter require a Java Class (in this case com.facebook.LoginActivity) that listen to the external call when invoked and this can only be generated by Corona.
I don’t know if it already exists and how can we handle this but it would be much easier if we can do something like this in build.config

android = { intentFilter = { { name = "android.intent.action.VIEW" }, { category = "android.intent.category.DEFAULT" }, { category = "android.intent.category.BROWSABLE" }, { data = { scheme = "fb123456789101112", host = "authorize", }, }, } }

I haven’t implemented yet, I have these URLs saved for when I tackle it, maybe helps you.

iOS: http://www.coronalabs.com/blog/2011/12/22/using-app-url-schemes-in-ios/ 

Android: http://forums.coronalabs.com/topic/37105-handling-url-scheme-on-android/

Wow! Thanks man! Trying now! :slight_smile:

I haven’t implemented yet, I have these URLs saved for when I tackle it, maybe helps you.

iOS: http://www.coronalabs.com/blog/2011/12/22/using-app-url-schemes-in-ios/ 

Android: http://forums.coronalabs.com/topic/37105-handling-url-scheme-on-android/

Wow! Thanks man! Trying now! :slight_smile:

@ 10undertiber - Did those Urls work for you (save me the trouble of going down the same bad path if they didn’t)?

 Yes, tested on the latest public release.

Great, many thanks for replying.

FYI, anyone trying to follow those links the iOS one is broken. It has extra hidden characters on it and will lead to an “Epic 404” error. This one works:

www.coronalabs.com/blog/2011/12/22/using-app-url-schemes-in-ios

10undertiber, it looks like you were able to get the intent filter working.  I have posted my build.settings file in my thread.  I was wondering if you could share how your intent filter was setup in build.settings?  Thanks!

http://forums.coronalabs.com/topic/42115-intent-filter-issues/

@ 10undertiber - Did those Urls work for you (save me the trouble of going down the same bad path if they didn’t)?

 Yes, tested on the latest public release.

Great, many thanks for replying.

FYI, anyone trying to follow those links the iOS one is broken. It has extra hidden characters on it and will lead to an “Epic 404” error. This one works:

www.coronalabs.com/blog/2011/12/22/using-app-url-schemes-in-ios

10undertiber, it looks like you were able to get the intent filter working.  I have posted my build.settings file in my thread.  I was wondering if you could share how your intent filter was setup in build.settings?  Thanks!

http://forums.coronalabs.com/topic/42115-intent-filter-issues/

Can I pass image using URL Scheme in ios.?

Can I pass image using URL Scheme in ios.?