Why fusedLocationProviderClient.getLastLocation never call OnSuccessListener?

543 views Asked by At

On kitkat, when i do

fusedLocationProviderClient.getLastLocation()
  .addOnSuccessListener(new OnSuccessListener<Location>() {
      @Override
      public void onSuccess(Location location) {
          if (location == null) { 
            Log.w(TAG, "Their is no last grabbed location currently available"); 
            return;
          }
          Log.v(TAG, "Processing last grabbed location");
      }
  })
  .addOnFailureListener(new OnFailureListener() {
      @Override
      public void onFailure(@NonNull Exception e) {
          Log.w(TAG, "Error trying to get last grabbed location");
      }
  });   

then the OnSuccessListener and the OnFailureListener are never called ! it's work on lollipop+ but on my kitkat it's simply never execute any listener ... any idea why ?

1

There are 1 answers

0
zeus On

Ok, i found out, it's was because google play services was not updated the the last version