Hello,
I’ve set up a Custom URL Scheme and placed an HTML page on the web to open the app using the URL Scheme. I’m getting the URL and its params when the app returns from suspend, but not getting any “launchArgs” (…) when starting the app up.
HTML:
window.location = "myapp://This/Is/A/TEST";
main.lua:
local launchArgs = ... if(launchArgs)then native.showAlert( "launchArgs!", require('json').encode(launchArgs), {"OK"} ) end
System Events Listener *This is Working*:
local function onSystemEvent( event ) local launchArgs = event launchArgs.type = nil launchArgs.name = nil if(next(launchArgs) ~= nil)then native.showAlert( "launchArgs!", require('json').encode( launchArgs ), {"ok"} ) end local eventType = event.type if ( eventType == "applicationStart" ) then -- Occurs when the application is launched and all code in "main.lua" is executed elseif ( eventType == "applicationOpen" ) then -- Occurs when the application is asked to open a URL resource (Android and iOS only) elseif ( eventType == "applicationResume" ) then -- Perform all necessary actions for when the app resumes from a suspended state elseif ( eventType == "applicationSuspend" ) then -- Perform all necessary actions for when the device suspends the application, i.e. during a phone call elseif ( eventType == "applicationExit" ) then -- Occurs when the user or OS task manager quits the application end end Runtime:addEventListener( "system", onSystemEvent )
The same issue with the same behavior is happing both on Android and iOS.
Thanks for your help in advance…
Mars Team