public final void onAddGeofencesResult(Status status) { WLog.d(SynchronizedLocationClient.access$200(), "onAddGeofencesResult()"); switch (status.getStatusCode()) { default: SynchronizedLocationClient.access$400(SynchronizedLocationClient.this, new LocationClientException(String.format("addGeofences failed - unknown error: %d", new Object[] { Integer.valueOf(status.getStatusCode()) }))); return; case 0: // '\0' SynchronizedLocationClient.access$300(SynchronizedLocationClient.this); return; case 1001: SynchronizedLocationClient.access$400(SynchronizedLocationClient.this, new LocationClientException("addGeofences failed: GEOFENCE_TOO_MANY_GEOFENCES")); return; case 1002: SynchronizedLocationClient.access$400(SynchronizedLocationClient.this, new LocationClientException("addGeofences failed: GEOFENCE_TOO_MANY_PENDING_INTENTS")); return; case 1000: SynchronizedLocationClient.access$400(SynchronizedLocationClient.this, new LocationClientException("addGeofences failed: GEOFENCE_NOT_AVAILABLE")); return; case 1: // '\001' SynchronizedLocationClient.access$400(SynchronizedLocationClient.this, new LocationClientException("addGeofences failed: ERROR")); return; } }
public void onResult(Status status) { if (status.isSuccess()) { Toast.makeText(getApplicationContext(), Constantes.geofences_added, Toast.LENGTH_SHORT) .show(); } else { String errorMessage = getErrorString(this, status.getStatusCode()); Toast.makeText(getApplicationContext(), errorMessage, Toast.LENGTH_LONG).show(); } }
public void onResult(Status status) { if (status.isSuccess()) { SharedPreferences.Editor editor = mSharedPreferences.edit(); editor.putBoolean(Constants.GEOFENCES_ADDED_KEY, mGeofencesAdded); editor.apply(); } else { String errorMessage = GeofenceErrorMessages.getErrorString(this, status.getStatusCode()); Log.e(TAG, errorMessage); } }
@Override public void onResult(Status result) { if (!result.isSuccess()) { Log.d( "", "Failed to send message. statusCode: " + result.getStatusCode() + " message: " + mMessage); } }
/** * Runs when the result of calling addGeofences() and removeGeofences() becomes available. Either * method can complete successfully or with an error. * * <p>Since this activity implements the {@link ResultCallback} interface, we are required to * define this method. * * @param status The Status returned through a PendingIntent when addGeofences() or * removeGeofences() get called. */ public void onResult(Status status) { if (status.isSuccess()) { // Update state and save in shared preferences. mGeofencesAdded = !mGeofencesAdded; SharedPreferences.Editor editor = mSharedPreferences.edit(); editor.putBoolean(Constants.GEOFENCES_ADDED_KEY, mGeofencesAdded); editor.commit(); // Update the UI. Adding geofences enables the Remove Geofences button, and removing // geofences enables the Add Geofences button. setButtonsEnabledState(); Toast.makeText( this, getString(mGeofencesAdded ? R.string.geofences_added : R.string.geofences_removed), Toast.LENGTH_SHORT) .show(); } else { // Get the status code for the error and log it using a user-friendly message. String errorMessage = GeofenceErrorMessages.getErrorString(this, status.getStatusCode()); Log.e(TAG, errorMessage); } }