Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

URI Scheme
Started by davidgmonical Apr 20 2019 01:17 PM

6 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

davidgmonical

[GLOBAL: userInfoPane.html]
davidgmonical
  • Enthusiast

  • 84 posts
  • Corona SDK

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



[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,544 posts
  • Corona SDK

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)


Edited by roaminggamer, 21 April 2019 - 11:54 AM.


[TOPIC: post.html]
#3

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,544 posts
  • Corona SDK

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.


Edited by roaminggamer, 21 April 2019 - 11:45 AM.


[TOPIC: post.html]
#4

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,544 posts
  • Corona SDK

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



[TOPIC: post.html]
#5

davidgmonical

[GLOBAL: userInfoPane.html]
davidgmonical
  • Enthusiast

  • 84 posts
  • Corona SDK

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.



[TOPIC: post.html]
#6

xnailbender

[GLOBAL: userInfoPane.html]
xnailbender
  • Contributor

  • 360 posts
  • Corona SDK

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",
                },
            },
        },


[TOPIC: post.html]
#7

xnailbender

[GLOBAL: userInfoPane.html]
xnailbender
  • Contributor

  • 360 posts
  • Corona SDK

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




[topic_controls]
[/topic_controls]