1

This is a very close question to lots of other questions out there (i.e. Android Regular GPS Polling in Service, maximizing battery life). However, what I need is quite different.

So, basically im looking for a way to regularly poll Android devices using the LocationManager class. Specifically, I want the SATELLITE information (NOT the Location itself). I.e. I just want the number of satellites, the signal-to-noise ratio and so on. I am looking to do this in the most battery efficient way possible.

One way to do it is to get the satellite information using the onGpsStatusChanged callback, and then getting the satellites with something like location_manager.getGpsStatus(null).getSatellites(). This is indeed, how I am doing it.

Relating to this now, I have a few questions that I cannot find anywhere in the Android documentations or in any forum online i've seen!

  1. Will onGpsStatusChanged be called without adding a LocationListener to my LocationManager? Can I just somehow query the GPS receiver to send me the satellite info without registering a LocationListener as well? I.e. Is there a direct way of doing it other than something like:

            location_manager.addGpsStatusListener(gps_status_listener_);
            location_manager.requestLocationUpdates(location_manager.getProvider(LocationManager.GPS_PROVIDER).getName(), 3000, 2f, location_listener_);
    

    Because for me, the LocationListener is useless.

  2. Is it more battery efficient to attach the GPSStatusListener periodically, get satellite info and remove the listener OR just attach it once and keep polling until a certain period where I don't need it anymore. I realize continuous polling is battery inefficient and most of the questions out there deal with polling the LocationManager with requestLocationUpdates and setting minTime and minDistance etc. to minimize the amount of battery consumed. However, I only need the satellite information, so maybe there is a way to poll continuously without this consumption of battery?

  3. This leads right into my next question which is: How quickly does the GPSStatusListener get the satellite info on average. I realize getting a LOCATION takes a while and depends on the Providers and LastKnownLocation and yada yada. But what about the satellite info? Is it quicker?

If anyone can help me out here, I would be highly obliged! Thank you in advance all!

Community
  • 1
  • 1
Hamza Tahir
  • 416
  • 5
  • 13

0 Answers0