getUserLocation() returns 0, 0 on devices... Any ideas? Permission is granted to Location Data.

Hey guys, I am having and issue with getting the GPS location coordinates using getUserLocation(); This is on a test build using public build 2189. The app has permission to access the location data via iOS. It returns 0 , 0 on the iOS Simulator and Devices, and 37, -122 in corona simulator. Any help would be awesome. Thanks. 

local myMap = native.newMapView( 0, 0, 320, 100 ); myMap.x = \_W/2; myMap.y = 10 myMap.isVisible = true; local locationTable = myMap:getUserLocation(); local locationtxt = display.newText( "My location is: ", 0, 0, native.systemFont, 16 ) locationtxt:setFillColor( 1, 1, 1 ); locationtxt.y= \_H/2 + 90; locationtxt.x = \_W/2; local function callMap() if ( locationTable.errorCode ) then locationtxt.text = locationtxt.text .. locationTable.errorMessage native.showAlert( "GPS Location Error", locationTable.errorMessage, {"OK"} ) else native.showAlert( "GPS Location Found", locationTable.latitude .. " : " .. locationTable.longitude, {"OK"} ) locationtxt.text = locationtxt.text .. locationTable.latitude .. ", " ..locationTable.longitude myMap:nearestAddress(locationTable.latitude, locationTable.longitude); end timer.cancel(tmr); tmr = nil; end tmr = timer.performWithDelay(5000, callMap, 1);

I don’t know if this will help, but I was only able to get the user location AFTER the map was called and even then after a delay.

ex: timer.performWithDelay(1000, getUserLocation, 1)

I don’t know if this will help, but I was only able to get the user location AFTER the map was called and even then after a delay.

ex: timer.performWithDelay(1000, getUserLocation, 1)

@jmarchalonis … a few years late (I found this thread because I have a (new) problem with getUserLocation on Android) … but I wanted to thank you for mentioning the hard coded values on the simulator. Since I live in 37.x / -122.y (where .x and .y aren’t 0), I was assuming the simulator was actually giving me a rounded-to-integer version of my location :slight_smile: (Now I know it isn’t.)