title: FusedLocationProviderClient when and how to stop Looper?
body: <p>I used to use FusedLocationApi until I learned that it is deprecated (see references below). It was simple to implement. As the documentation says you need to use it in conjunction with GoogleApiClient</p>
  
  <pre><code>LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient,
                          locationRequest, this);
  </code></pre>
  
  <p>I recently changed to FusedLocationProviderClient (see reference below) Following a tutorial I was able to successfully get FusedLocationProviderClient working</p>
  
  <p>Tutorial: <a href="https://github.com/codepath/android_guides/wiki/Retrieving-Location-with-LocationServices-API" rel="noreferrer">https://github.com/codepath/android_guides/wiki/Retrieving-Location-with-LocationServices-API</a></p>
  
  <pre><code>// new Google API SDK v11 uses getFusedLocationProviderClient(this)
  getFusedLocationProviderClient(this).requestLocationUpdates(mLocationRequest, new LocationCallback() {
        @Override
        public void onLocationResult(LocationResult locationResult) {
           // do work here
           onLocationChanged(locationResult.getLastLocation();
        }
      },
      Looper.myLooper());
  </code></pre>
  
  <p>The issue I am running into is the Looper thread. Even with the application in the background, the Looper thread continues to run. I would like to pause location updates when the application is in the background and then resume location updates when the application is in the foreground. How can I achieve this?</p>
  
  <p>References:</p>
  
  <ol>
  <li><a href="https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderApi" rel="noreferrer">https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderApi</a></li>
  <li><a href="https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderClient" rel="noreferrer">https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderClient</a></li>
  </ol>