Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

I can't get application launch arguments when using url scheme
Started by lelinhit09 Apr 25 2018 01:13 AM

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

lelinhit09

[GLOBAL: userInfoPane.html]
lelinhit09
  • Observer

  • 6 posts
  • Corona SDK

I can't get application launch arguments when using url scheme
In the build.settings file is declared as follows:

android = {
intentFilters =
{
{
label = "Optional Title Goes Here",
actions = { "android.intent.action.VIEW" },
categories =
{
"android.intent.category.DEFAULT",
"android.intent.category.BROWSABLE",
},
data = { scheme = "schemeapp" },
},
},
}

In the main.lua

local launchArguments = ...
if launchArguments then

else

end

launchArguments always returns nil
Help me!

 



[TOPIC: post.html]
#2

xnailbender

[GLOBAL: userInfoPane.html]
xnailbender
  • Contributor

  • 330 posts
  • Corona SDK

Le, I think you can get the launch args like this.

 

local onSystemEvent = function(event)  --place in main.lua
    
    print("---OnSystemEven has been called")
    
    local eventType = event.type;
    print("-- eventType == ", eventType)
    
    local eventURL = event.url;
    print("-- eventURL == ", eventURL)
   
    if (eventType == "applicationOpen") then -- app resumes from background
        print("--applicationOpen has been called")
 
    elseif (eventType == "applicationStart") then
        print("--applicationStart has been called")
      
    elseif (eventType == "applicationResume") then -- app resumes from background
        print("---applicationResume has been called")
        
    elseif (eventType == "applicationSuspend") then --
        print("---applicationSuspend has been called")
    elseif (eventType == "applicationExit") then
        print("--applicationExit has been called")    
       
    end
end
 
Runtime:addEventListener("system", onSystemEvent)
     

 

Take a look at my post on this thread, it has the intent filters and permissions to make it work.

 

I'm not sure exactly what you are trying to do with the url scheme, maybe open a file from email or just open the app from another app. Maybe you could explain how you are trying to use it.

 

Hope this helps,

 

Nail




[topic_controls]
[/topic_controls]