0

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 ;)

EarlGrey
  • 531
  • 7
  • 29
  • How are you using Google Play Services without linked Google Account? – AlexTa Apr 11 '17 at 08:50
  • @AlexTa I installed it via a mirrored apk and then use it in the code as the tutorial explains. As I understood, the location service is an interface to the GPS hardware in the phone and doesn't need an internet connection. So no connection to googles servers should be required. But maybe I'm wrong? – EarlGrey Apr 11 '17 at 08:53
  • 1
    @AlexTa Play services don't actually need an account. You only need an account to access Play Store and get the latest Play services. Catch 22. If you sideloaded latest Play services APK this doesn't concern you. – Eugen Pechanec Apr 11 '17 at 08:53
  • @EarlGrey In your conditions only GPS is a viable source of location info. The thing is GPS is only available outdoors. – Eugen Pechanec Apr 11 '17 at 08:54

2 Answers2

2

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.

0

I had same problem using Samsung galaxy S7 and tried with SIM and without SIM but problem persist so When I was facing the problem opened google Map and it was showing change the provider for better accuracy(HIGH Accuracy).After changed the provider it works perfectly. we can follow same thing like google Map

MIkka Marmik
  • 1,101
  • 11
  • 29