getLastKnownPosition returns null even if location previously queried before.
🐛 Bug Report
From the documentation, my expectation for the .getLastKnownPosition() method is that it will fetch the last valid geolocation that has been previously queried. I tested this out by first getting a working geo location, and turning off the location sensor, and hot restarting the application. The method returns null every time.
The same behaviors exhibited in the sample application.
I am unsure if this is expected behavior since being able to query the last known good location means that the geocoordinates to have be stored somewhere persistent in memory and I do not have the foreknowledge if the application or Android does that. Please correct me if I'm wrong.
Expected behavior
getLastKnownPosition() should provide the last known good geocoordinates that can be retrieved regardless of sensor status.
Reproduction steps
- Run the example application.
- Turn on location settings and enable application permission.
- Retrieve coordinates.
- Turn off location sensor.
- Hot restart application.
Configuration
Version: 5.0.0
Platform:
- [ ] :iphone: iOS
- [x] :robot: Android
Hey Carrein,
I looked at this issue and according to the Android API this is correct. If you turn off the location service the cache will be cleared, so we can't read this from the memory. See this link for more info: https://developer.android.com/training/location/retrieve-current#last-known
@Carrein
like this