The GPS for some android device doesn’t seem to be working. I am trying to get the long/lat of my current location but it doesn’t return any value at all. I tried using the app to my Galaxy S2 and it was working ok. I enabled
“android.permission.ACCESS_FINE_LOCATION”,
“android.permission.ACCESS_COARSE_LOCATION”,
Inside the build.settings. Here is my sample code. What’s causing this problem?
local locationHandler = function( event ) if event.errorCode then native.showAlert( "GPS Location Error", event.errorMessage, {"OK"} ) print( "Location error: " .. tostring( event.errorMessage ) ) else local location = "\nLocation latitude: " .. event.latitude .. "\nLocation longitude: " .. event.longitude; native.showAlert("Your location", location, {"Close"}) end end Runtime:addEventListener( "location", locationHandler )