URI Scheme

I’m attempting to use the URI scheme of another app.

For iOS, I am using system.openURL(“app://”) and it is working perfectly.

However, when I try to do the same for Android, I get ERR_UNKNOWN_URL_SCHEME.

I’ve tried instead doing system.openURL(“com.company.app://”) and get the same thing.

I’ve looked through basically all of the existing forums on getting it to work in Android, and I’ve found a lot on creating your own URI, but not on calling one. Is it possible? Am I doing something wrong?

Thanks

This has been talked about before, I’d do a deep dive in the forums.

This may or may not help:

  1. https://forums.coronalabs.com/topic/50879-custom-url-schemes-ios-pintrest-google-instagram-tumblr/#entry
  2. https://forums.coronalabs.com/topic/73412-update-from-ios-url-scheme-to-universal-link/
  3. intent filters (not sure if this still works) https://forums.coronalabs.com/topic/42115-intent-filter-issues/

Google:  site: coronalabs.com url scheme

Isn’t it URL, not URI?  I’m probably wrong here, but be aware others may have made the same mistake I did so, searching for both URL and URI might get more complete results.

https://en.wikipedia.org/wiki/Uniform_Resource_Identifier (interesting)

Final note.  I’m not trying to nip this discussion in the bud, so if anyone has more to contribute please do.  I simply wanted to point out, the solution/info desired may be buried deep in another forum discussion and I’ve given a way to dig for it.

Dang… one more thing.  Please show us your build.settings file.  You may not have the right settings there for internet access.  Also, I do believe there is some work to do in the build.settings for specific URI schemes.

If you get this worked, out, please share the solution here.

Thanks for the replies. Yeah I’ve stumbled across all of those on my google searching and couldn’t glean anything useful for using other apps’ URI schemes (seems like some people say URI some say URL, also not sure which is technically correct) for Android.

Right now I’m attempting to use Corona Native and make a plugin for more easily launching activities of another application, and am making great progress. If I get it fully working I’ll try to put it on the market for other people to use.

My build.settings, which I think isn’t what’s causing the potential issue.

android = { usesExpansionFile = false, usesPermissions = { "android.permission.INTERNET", "android.permission.WRITE\_EXTERNAL\_STORAGE", --optional permission used to display current location via the GPS "android.permission.ACCESS\_FINE\_LOCATION", --optional permission used to display current location via WiFi or cellular service "android.permission.ACCESS\_COARSE\_LOCATION", }, usesFeatures = { -- If you set permissions "ACCESS\_FINE\_LOCATION" and "ACCESS\_COARSE\_LOCATION" above, -- you may want to set up your app to not require location services as follows. -- Otherwise, devices that do not have location sevices (such as a GPS) will be unable -- to purchase this app in the app store. { name = "android.hardware.location", required = false }, { name = "android.hardware.location.gps", required = false }, { name = "android.hardware.location.network", required = false } }, }, plugins = { ["CoronaProvider.native.popup.social"] = { publisherId = "com.coronalabs" }, -- ["CoronaProvider.native.popup.activity"] = -- { -- publisherId = "com.coronalabs" -- }, ["plugin.bit"] = { publisherId = "com.coronalabs" }, ["plugin.notifications.v2"] = { publisherId = "com.coronalabs" }, },

I was more wondering whether it’s actually supposed to be possible on Android. If it is perhaps there’s something setup wrong in the app I am trying to open, though I don’t think this is the case.

Guys,

I’ve got this working in one of my apps. Missing “intents” and maybe a permission.

I’m calling a credit card service app to pass a transaction and return a table to my app when finished.

Here’s what I have.

function Cash.printThisOnURLReturn( event ) if event.type == "applicationOpen" and event.url then LaunchURL = event.url print( LaunchURL ) --do something end end Runtime:addEventListener( "system", Cash.printThisOnURLReturn) --call the URL if not system.openURL("app-youAreCalling-URL://charge/1.0.0/?amount="..Cash.CreditCardTotal.."&email="..Cash.CustomerCreditCardEmailAddress.."&description="..TextFile.."&returnAppName="..\_tempStoreName.."&returnURL=your.apps.packeageName.youSeeInTheAndroidBuildWindo://Cash.printThisOnURLReturn") then print("\<\<\<\< Cannot OPEN APP") end

Not sure what is needed in build.settings, but this works

--build.settings usesPermissions = { "android.permission.INTERACT\_ACROSS\_USERS", "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.WRITE\_EXTERNAL\_STORAGE", "android.permission.ACCESS\_FINE\_LOCATION", "android.permission.ACCESS\_COARSE\_LOCATION", -- uncomment if you use check licsense --"com.android.vending.CHECK\_LICENSE", }, intentFilters = { { label = "myApps Name", actions = { "android.intent.action.VIEW" }, categories = { "android.intent.category.DEFAULT", "android.intent.category.BROWSABLE", }, --Previous scheme below data = { scheme = "your.apps.package.name", }, }, { label = "myApps Dropbox Return uri", actions = { "android.intent.action.LAUNCHER" }, categories = { "android.intent.category.DEFAULT", }, data = { scheme = "myAppLabel", }, }, },

Guys,

I pondered how to do this with a plugin previously.

I’ve never built a plugin before, but I’m curious if a plugin can modify the apps build.settings on load which would be required to happen since each Android Intent would have to be modified to pass in the apps package name and label.

I realize this is a branch, but…

The intents also need to be modified in order to register the app with certain file types so an app’s icon is available in the dialog box when you download a .png for example from an email.

I’ve discussed this in previous threads on how to register your app to show in the dialog box.  It would be great to be able to do in a plugin.  I don’t know if this is possible though.

Let me know what you think.

Nail

This has been talked about before, I’d do a deep dive in the forums.

This may or may not help:

  1. https://forums.coronalabs.com/topic/50879-custom-url-schemes-ios-pintrest-google-instagram-tumblr/#entry
  2. https://forums.coronalabs.com/topic/73412-update-from-ios-url-scheme-to-universal-link/
  3. intent filters (not sure if this still works) https://forums.coronalabs.com/topic/42115-intent-filter-issues/

Google:  site: coronalabs.com url scheme

Isn’t it URL, not URI?  I’m probably wrong here, but be aware others may have made the same mistake I did so, searching for both URL and URI might get more complete results.

https://en.wikipedia.org/wiki/Uniform_Resource_Identifier (interesting)

Final note.  I’m not trying to nip this discussion in the bud, so if anyone has more to contribute please do.  I simply wanted to point out, the solution/info desired may be buried deep in another forum discussion and I’ve given a way to dig for it.

Dang… one more thing.  Please show us your build.settings file.  You may not have the right settings there for internet access.  Also, I do believe there is some work to do in the build.settings for specific URI schemes.

If you get this worked, out, please share the solution here.

Thanks for the replies. Yeah I’ve stumbled across all of those on my google searching and couldn’t glean anything useful for using other apps’ URI schemes (seems like some people say URI some say URL, also not sure which is technically correct) for Android.

Right now I’m attempting to use Corona Native and make a plugin for more easily launching activities of another application, and am making great progress. If I get it fully working I’ll try to put it on the market for other people to use.

My build.settings, which I think isn’t what’s causing the potential issue.

android = { usesExpansionFile = false, usesPermissions = { "android.permission.INTERNET", "android.permission.WRITE\_EXTERNAL\_STORAGE", --optional permission used to display current location via the GPS "android.permission.ACCESS\_FINE\_LOCATION", --optional permission used to display current location via WiFi or cellular service "android.permission.ACCESS\_COARSE\_LOCATION", }, usesFeatures = { -- If you set permissions "ACCESS\_FINE\_LOCATION" and "ACCESS\_COARSE\_LOCATION" above, -- you may want to set up your app to not require location services as follows. -- Otherwise, devices that do not have location sevices (such as a GPS) will be unable -- to purchase this app in the app store. { name = "android.hardware.location", required = false }, { name = "android.hardware.location.gps", required = false }, { name = "android.hardware.location.network", required = false } }, }, plugins = { ["CoronaProvider.native.popup.social"] = { publisherId = "com.coronalabs" }, -- ["CoronaProvider.native.popup.activity"] = -- { -- publisherId = "com.coronalabs" -- }, ["plugin.bit"] = { publisherId = "com.coronalabs" }, ["plugin.notifications.v2"] = { publisherId = "com.coronalabs" }, },

I was more wondering whether it’s actually supposed to be possible on Android. If it is perhaps there’s something setup wrong in the app I am trying to open, though I don’t think this is the case.

Guys,

I’ve got this working in one of my apps. Missing “intents” and maybe a permission.

I’m calling a credit card service app to pass a transaction and return a table to my app when finished.

Here’s what I have.

function Cash.printThisOnURLReturn( event ) if event.type == "applicationOpen" and event.url then LaunchURL = event.url print( LaunchURL ) --do something end end Runtime:addEventListener( "system", Cash.printThisOnURLReturn) --call the URL if not system.openURL("app-youAreCalling-URL://charge/1.0.0/?amount="..Cash.CreditCardTotal.."&email="..Cash.CustomerCreditCardEmailAddress.."&description="..TextFile.."&returnAppName="..\_tempStoreName.."&returnURL=your.apps.packeageName.youSeeInTheAndroidBuildWindo://Cash.printThisOnURLReturn") then print("\<\<\<\< Cannot OPEN APP") end

Not sure what is needed in build.settings, but this works

--build.settings usesPermissions = { "android.permission.INTERACT\_ACROSS\_USERS", "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.WRITE\_EXTERNAL\_STORAGE", "android.permission.ACCESS\_FINE\_LOCATION", "android.permission.ACCESS\_COARSE\_LOCATION", -- uncomment if you use check licsense --"com.android.vending.CHECK\_LICENSE", }, intentFilters = { { label = "myApps Name", actions = { "android.intent.action.VIEW" }, categories = { "android.intent.category.DEFAULT", "android.intent.category.BROWSABLE", }, --Previous scheme below data = { scheme = "your.apps.package.name", }, }, { label = "myApps Dropbox Return uri", actions = { "android.intent.action.LAUNCHER" }, categories = { "android.intent.category.DEFAULT", }, data = { scheme = "myAppLabel", }, }, },

Guys,

I pondered how to do this with a plugin previously.

I’ve never built a plugin before, but I’m curious if a plugin can modify the apps build.settings on load which would be required to happen since each Android Intent would have to be modified to pass in the apps package name and label.

I realize this is a branch, but…

The intents also need to be modified in order to register the app with certain file types so an app’s icon is available in the dialog box when you download a .png for example from an email.

I’ve discussed this in previous threads on how to register your app to show in the dialog box.  It would be great to be able to do in a plugin.  I don’t know if this is possible though.

Let me know what you think.

Nail