Skip to content

Instantly share code, notes, and snippets.

Created January 22, 2016 17:05
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save FilHazer/7bc51e90f630421e7953 to your computer and use it in GitHub Desktop.
public class GeoIntentService extends IntentService{
private String LOG_TAG = "DEBUG";
public GeoIntentService() {
protected void onHandleIntent(Intent intent) {
Log.i(LOG_TAG, "onHandleIntent");
GeofencingEvent event = GeofencingEvent.fromIntent(intent);
if (event == null) {
if (event.hasError()) {
Log.i(LOG_TAG, "ERROR");
int transition = event.getGeofenceTransition();
if (transition == Geofence.GEOFENCE_TRANSITION_ENTER){
Log.i(LOG_TAG, "ENTER");
} else if(transition == Geofence.GEOFENCE_TRANSITION_DWELL ){
Log.i(LOG_TAG, "DWELL");
}else if(transition == Geofence.GEOFENCE_TRANSITION_EXIT) {
Log.i(LOG_TAG, "EXIT");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment