Code example for LocationClient

Methods: getLastLocation, isConnected

0
 
  /** 
   * Button to get current Location. This demonstrates how to get the current Location as required, 
   * without needing to register a LocationListener. 
   */ 
  public void showMyLocation(View view) {
    if (mLocationClient != null && mLocationClient.isConnected()) {
      String msg = "Location = " + mLocationClient.getLastLocation();
      Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
    } 
  } 
 
  /** 
   * Implementation of {@link LocationListener}. 
   */ 
  @Override 
  public void onLocationChanged(Location location) {
    mMessageView.setText("Location = " + location);
  } 
 
  /**