Created
November 24, 2014 17:03
-
-
Save CHLibrarian/67527271aa5b0d3011f0 to your computer and use it in GitHub Desktop.
ContextHub Element Services Geofence Create (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
// Creating a geofence with name "Geofence", lat/lng of ChaiOne, tag "geofence-tag", radius 250 meters | |
GeofenceProxy proxy = new GeofenceProxy(); | |
proxy.createGeofence("Geofence", 29.763638f, -95.461874f, 250, new String[]{"geofence-tag"}, | |
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(), "Created geofence: " + 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