Skip to content

Instantly share code, notes, and snippets.

@FilHazer
Created January 18, 2016 17:02
Show Gist options
  • Save FilHazer/9ca4bf6ab55db0efe9b7 to your computer and use it in GitHub Desktop.
Save FilHazer/9ca4bf6ab55db0efe9b7 to your computer and use it in GitHub Desktop.
GeofenceController
public class GeofenceController {
private static GeofenceController instance;
private GoogleApiClient googleApiClient;
public static GeofenceController getInstance() {
if (instance == null) {
instance = new GeofenceController();
}
return instance;
}
public void startGoogleApiClient(GoogleApiClient.ConnectionCallbacks callback, ConnectionFailedCallBack connectionFailedListener) {
googleApiClient = new GoogleApiClient.Builder(GeofenceApplication.CONTEXT)
.addApi(LocationServices.API)
.addConnectionCallbacks(callback)
.addOnConnectionFailedListener(connectionFailedListener)
.build();
googleApiClient.connect();
}
public void stopGoogleApiClient() {
googleApiClient.disconnect();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment