Skip to content

Instantly share code, notes, and snippets.

@FilHazer
Created January 22, 2016 16:48
Show Gist options
  • Save FilHazer/5dbece94a7504de286e1 to your computer and use it in GitHub Desktop.
Save FilHazer/5dbece94a7504de286e1 to your computer and use it in GitHub Desktop.
public class AddGeoConnectionCallBack implements GoogleApiClient.ConnectionCallbacks{
private String LOG_TAG = "DEBUG";
@Override
public void onConnected(Bundle bundle) {
Intent intent = new Intent(GeofenceApplication.CONTEXT, GeoIntentService.class);
PendingIntent pendingIntent = PendingIntent.getService(GeofenceApplication.CONTEXT, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
PendingResult<Status> result = LocationServices.GeofencingApi.addGeofences(GeofenceController.getInstance().getGoogleApiClient(), GeofenceController.getInstance().getAddGeofencingRequest(), pendingIntent);
result.setResultCallback(new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
if (status.isSuccess()) {
Log.i(LOG_TAG, "SUCCESS" + status);
} else {
Log.i(LOG_TAG, "FAILED: " + status.getStatusMessage() + " : " + status.getStatusCode());
}
}
});
}
@Override
public void onConnectionSuspended(int i) {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment