Created
November 24, 2014 17:10
-
-
Save CHLibrarian/08b89ebf1a73e2e442fe to your computer and use it in GitHub Desktop.
ContextHub Element Services Geofence Update (Android)
This file contains hidden or 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
// Updating a geofence with the name "Geofence 2" and adding the tag "office" | |
// In order to update a geofence, you need to pass in a valid geofence object | |
geofence.setName("Geofence 2"); | |
geofence.getTags().add("office"); | |
GeofenceProxy proxy = new GeofenceProxy(); | |
proxy.updateGeofence(geofence.getId(), geofence, new Callback<Geofence> { | |
@Override | |
public void onSuccess(Geofence result) { | |
// If you do not have push properly set up, you need to explicitly call synchronize on LocationService so it will generate events for this geofence | |
LocationService.getInstance().synchronize(); | |
Toast.makeText(getActivity(), result.getName(), Toast.LENGTH_SHORT).show(); | |
} | |
@Override | |
public void onFailure(Exception e) { | |
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment