Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, so let's try a combination of all the answers and updates so far and do something like this:</p> <ul> <li>Add the <a href="http://developer.android.com/reference/android/Manifest.permission.html#ACCESS_FINE_LOCATION" rel="noreferrer"><code>ACCESS_FINE_LOCATION</code></a> permission to your manifest</li> <li>Get an instance of the system <code>LocationManager</code></li> <li>Create a <a href="http://developer.android.com/reference/android/location/GpsStatus.Listener.html" rel="noreferrer"><code>GpsStatus.Listener</code></a> that reacts to <a href="http://developer.android.com/reference/android/location/GpsStatus.html#GPS_EVENT_SATELLITE_STATUS" rel="noreferrer"><code>GPS_EVENT_SATELLITE_STATUS</code></a></li> <li>Register the listener with <code>LocationManager</code> with <a href="http://developer.android.com/reference/android/location/LocationManager.html#addGpsStatusListener%28android.location.GpsStatus.Listener%29" rel="noreferrer"><code>addGpsStatusListener</code></a></li> </ul> <p>The GPS listener could be something like this:</p> <pre><code>GpsStatus.Listener listener = new GpsStatus.Listener() { void onGpsStatusChanged(int event) { if (event == GPS_EVENT_SATELLITE_STATUS) { GpsStatus status = mLocManager.getGpsStatus(null); Iterable&lt;GpsSatellite&gt; sats = status.getSatellites(); // Check number of satellites in list to determine fix state } } } </code></pre> <p>The APIs are a bit unclear about when and what GPS and satellite information is given, but I think an idea would be to look at how many satellites are available. If it's below three, then you can't have a fix. If it's more, then you should have a fix.</p> <p>Trial and error is probably the way to go to determine how often Android reports satellite info, and what info each <code>GpsSatellite</code> object contains.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload