Fused Location Provider: Is there a way to check if a location update failed? : <p><strong>Introduction</strong></p>

<p>In my app I want to get a one-off accurate location of where the user currently is. When I used <code>FusedLocationProviderApi.getLastLocation</code> sometimes this would be null or out of date location because I found out this just gets a cached location and does not request a new location update.</p>

<p>The solution was to request a location update only once as seen below.</p>

<pre><code> LocationRequest locationRequest  = LocationRequest.create()
                .setNumUpdates(1)
                .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
                .setInterval(0);

        LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient,locationRequest,this)
</code></pre>

<p>Now I get a more accurate location all the time.</p>

<p><strong>My Question</strong></p>

<p>How can I determine if a location update failed? Since I am only requesting 1. </p>

<p>When a location update is obtained this callback is invoked</p>

<pre><code> @Override
 public void onLocationChanged(Location location) {

 }
</code></pre>

<p>However this does not get called if a location update failed.</p>

<p><strong>What I have tried</strong></p>

<p>I saw there was a ResultCallback. However, onSuccess seems to be always called even if the one-off location update failed. </p>

<pre><code>LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient,locationRequest,this).setResultCallback(new ResultCallbacks&lt;Status&gt;() {
            @Override
            public void onSuccess(@NonNull Status status) {
                DebugUtils.log("requestLocationUpdates ResultCallback onSuccess + " + status.toString(),true,true);
            }

            @Override
            public void onFailure(@NonNull Status status) {
                DebugUtils.log("requestLocationUpdates ResultCallback onFailure + " + status.toString(),true,true);
            }
        });
</code></pre>

<p><strong>Other</strong></p>

<p>Using <code>com.google.android.gms:play-services-location:8.4.0</code></p>

<p>Thanks for reading, please help me out.</p>
