-
-
Save FilHazer/7bc51e90f630421e7953 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GeoIntentService extends IntentService{ | |
private String LOG_TAG = "DEBUG"; | |
public GeoIntentService() { | |
super("GeoIntentService"); | |
} | |
@Override | |
protected void onHandleIntent(Intent intent) { | |
Log.i(LOG_TAG, "onHandleIntent"); | |
GeofencingEvent event = GeofencingEvent.fromIntent(intent); | |
if (event == null) { | |
return; | |
} | |
if (event.hasError()) { | |
Log.i(LOG_TAG, "ERROR"); | |
return; | |
} | |
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