Search code examples
androidgoogle-play-servicesgoogle-location-services

Device doesn't receive location updates


I'm working on an app which needs location updates. So i followed the official tutorial and run the app on my development device. GPS is activated and everything should work, but onLocationChanged() is never called.
Then I run the app on my personal smartphone and everything worked as expected. So I began thinking about the differences between my development and my private device. The most distinguishing features of my development phone are:

  1. no SIM card
  2. no Google account is linked
  3. no WiFi available => no Internet connection

Number 3 already forced me to download the latest Google Play Services apk from a mirror and installing it manually. Is there something else I have to do to enable my development phone to use the location service?

Specs of my development device:
Samsung Galaxy S7
Android 7.0
Google Play services 10.2.99


EDIT
As @EugenPechanec pointed out, relying on GPS only needs a GPS connection, so to be outdoors is really helpful. Turning my private phone's flight mode on and only activating GPS led me to the same result as with the development device. Placing it by the window got me a position 1/3 times with it and 0/3 times with the development device. So this seems very legit. Thanks a lot for this reminder on GPS ;)


Solution

  • Android devices with GPS check if the network connection is available. If so, they download data from a A-GPS server and use it to correct the location of the GPS chip. If not, the GPS chip has to download the data from a GPS satellite, which is really slow and takes a long time, the rate is like 50 bits per second. Maybe your development device needs a long time to update the position.