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!
Le, I think you can get the launch args like this.
[lua]
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)
[/lua]
Take a look at my post onthis 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
Le, I think you can get the launch args like this.
[lua]
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)
[/lua]
Take a look at my post onthis 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