Using LocationManager with a GPS_PROVIDER on API Level 23 on android emulator of Android studio.
Getting location every 5 seconds with a minDistance of 0:
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 0, ll);
I get longitude and latitude correctly every 5 seconds, but the elevation very scarcely and randomly.
During one minute, location.hasAltitude()
is false
, and location.getAltitude()
equals 0, and then I will get a correct value.
Is this because of the emulator hardware ? Can I get more data ?
As pointed out most emulators are not made for hardware testing or hardware simulation, and their GPS data is not realistic.
What can be done is replaying data from a real device on the emulator. On different emulators this can be done by importing a GPX or KLM file exported from different GPS applications, from a real device, or from the emulated one if the application allows drawing arbitrary routes.