0

I asked this question (Why Does Map Marker Lurch Around The Map) yesterday. One thing I noticed today is that for an activity that uses LocationManager, but not a map I get the GPS icon (satalite dish beaming signals up) in the status tray. With the activity that has a map fragment and also uses LocationManager I do not get the GPS icon in the tray. I copied and pasted the location manager code from one activity to the other.

Why would the GPS come on some times and not others?

Greg

Community
  • 1
  • 1
user1091524
  • 865
  • 1
  • 15
  • 28
  • Are you sure that you're requesting location callbacks from GPS? In that code it looks like you're just requesting network location callbacks, unless the GPS radio is enabled during use in the provider enabled callback. – Daniel Nugent Jun 14 '15 at 20:27
  • That was it, thanks. I changed LocationManager.NETWORK_PROVIDER to LocationManager.GPS_PROVIDER. Now to test to see if it gets more accurate. – user1091524 Jun 14 '15 at 20:34
  • Nice, it looks like this was the root cause of your issue in the other question as well. I just added an answer to that question. – Daniel Nugent Jun 14 '15 at 20:59

1 Answers1

0

It depend on global GPS setting - if it's globally on, using LocationManager in your Activity\Fragment will fire "satellite dish". If GPS is globally switched off - using LocationManager will not fire.

The reason is that GPS is a huge power consumerist, and allowing it to run without clear user decision to switch it on will drain the device battery extremely quickly.

Andrey Kopeyko
  • 1,556
  • 15
  • 14
  • It is the same app with two activities that seem to use location differently as it applies to GPS. I don't change the phones settings for GPS. One activity uses it and the other seems not to. – user1091524 Jun 14 '15 at 20:29
  • oh, the reason seems to be that in second case you don't call for `requestLocationUpdates(LocationManager.GPS_PROVIDER, ...)` – Andrey Kopeyko Jun 15 '15 at 20:33