Code example for LocationClient

Methods: connect, isConnected

0
  } 
 
  private boolean ensureServiceConnected() { 
    // Make sure location client is initialized. 
    if (mLocationClient == null) {
      mLocationClient = new LocationClient(mActivity, this, this);
    } 
    // Make sure location client is connected. 
    if (mLocationClient.isConnected()) {
      return true; 
    } 
    mLocationClient.connect();
    return false; 
  } 
 
  private void disconnect() { 
    if (mLocationClient != null && mLocationClient.isConnected()) {
      Logger.i(this, "will disconnect");
      mLocationClient.disconnect();
    } 
  }