Exemplo n.º 1
0
  public void removeUpdates() {
    if (mGoogleApiClient == null) {
      return;
    }

    mLocationRequestTimeOut.cancel();
    if (mGoogleApiClient.isConnected()) {
      LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
    }
  }
Exemplo n.º 2
0
  void requestLocationOrDeliverCurrent() {
    if (mGoogleApiClient == null) {
      return;
    }

    final Location location = getLastLocation();
    if (isLocationAcceptable(location)) {
      onLocationChanged(location);
    } else {
      mLocationRequestTimeOut.start();
      LocationServices.FusedLocationApi.requestLocationUpdates(
          mGoogleApiClient, createLocationRequest(), this);
    }
  }