Esempio n. 1
0
 public void OnPause()
 {
     if (locClient_.IsConnected)
     {
         locClient_.Disconnect();
     }
 }
Esempio n. 2
0
 public void AddGeofences()
 {
     // Start a request to add geofences
     mRequestType = RequestType.Add;
     // Test for Google Play services after setting the request type
     if (!IsGooglePlayServicesAvailable)
     {
         Log.Error(Constants.TAG, "Unable to add geofences - Google Play services unavailable.");
         return;
     }
     // Create a new location client object. Since this activity implements ConnectionCallbacks and OnConnectionFailedListener,
     // it can be used as the listener for both parameters
     mLoactionClient = new LocationClient(this, this, this);
     // If a request is not already underway
     if (!mInProgress)
     {
         // Indicate that a request is underway
         mInProgress = true;
         // Request a connection from the client to Location Services
         mLoactionClient.Connect();
     }
     else
     {
         // A request is already underway, so disconnect the client and retry the request
         mLoactionClient.Disconnect();
         mLoactionClient.Connect();
     }
 }
Esempio n. 3
0
 protected void StopTrackingLocation()
 {
     if (mLocationClient.IsConnected)
     {
         mLocationClient.RemoveLocationUpdates(this);
     }
     mLocationClient.Disconnect();
 }
Esempio n. 4
0
 public void Stop()
 {
     this.isReporting = false;
     if (mLocationClient.IsConnected)
     {
         mLocationClient.RemoveLocationUpdates(this);
     }
     mLocationClient.Disconnect();
 }
Esempio n. 5
0
        protected override void OnPause()
        {
            base.OnPause();
            Log.Debug("OnPause", "OnPause called, stopping location updates");

            if (locClient.IsConnected)
            {
                // stop location updates, passing in the LocationListener
                locClient.RemoveLocationUpdates(this);

                locClient.Disconnect();
            }
        }
Esempio n. 6
0
 public void OnAddGeofencesResult(int statusCode, string[] geofenceRequestIds)
 {
     // Log if adding the geofences was successful
     if (LocationStatusCodes.Success == statusCode)
     {
         if (Log.IsLoggable(Constants.TAG, LogPriority.Debug))
         {
             Log.Debug(Constants.TAG, "Added geofences successfully.");
         }
     }
     else
     {
         Log.Error(Constants.TAG, "Failed to add geofences. Status code: " + statusCode);
     }
     // turn off the in progress flag and disconnect the client
     mInProgress = false;
     mLoactionClient.Disconnect();
 }
 public void Stop()
 {
     _locationClient.Disconnect();
 }