I want to keep detecting user location even when app is running in background & if I found user on certain location I need to do something. For that I’ve written logic as following:
local function listener()
– detect user location
– if userLoc == requiredLoc then
--do something
end
timer.performWithDelay(3000, listener, -1)
This will work when app will be running in foreground but I need it to keep executing even in suspend mode.
Does run time listener work & call listener function even in suspend mode.
local function locationHandler( event )
DeviceLocation.lati = event.latitude
DeviceLocation.longi = event.longitude
print("DeviceLocation.lati ",DeviceLocation.lati)
print("DeviceLocation.longi ",DeviceLocation.longi)
end
Runtime:addEventListener( “location”, locationHandler )