Skip to content

Instantly share code, notes, and snippets.

@FilHazer FilHazer/GeoIntentService.java Secret
Created Jan 22, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.