title: How to wait for requestLocationUpdates() callback intent to finish?
body: <p>I want to wait for the callback intent in <a href="https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderClient.html#requestLocationUpdates(com.google.android.gms.location.LocationRequest,%20android.app.PendingIntent)" rel="nofollow noreferrer">FusedLocationProviderClient.requestLocationUpdates()</a> to finish. Is a while loop with a timeout the best solution? Below is an example, sans timeout.</p>
  
  <p>Normally I would use <a href="https://developer.android.com/reference/android/support/v4/content/WakefulBroadcastReceiver.html#startWakefulService(android.content.Context,%20android.content.Intent)" rel="nofollow noreferrer">startWakefulService()</a> to wait for an asynchronous service to complete, but I don't know a way to use it with requestLocationUpdates().</p>
  
  <pre><code>Task t = flpc.requestLocationUpdates(locationRequest, pe);
  while (! t.isSuccessful()) {
      Log.v(TAG, "Waiting for result...");
  }
  </code></pre>