Skip to content

Instantly share code, notes, and snippets.

@CHLibrarian
Last active August 29, 2015 14:09
Show Gist options
  • Save CHLibrarian/3c5a59e3589720915d5f to your computer and use it in GitHub Desktop.
Save CHLibrarian/3c5a59e3589720915d5f to your computer and use it in GitHub Desktop.
ContextHub Event Services Add Event Subscription (Android)
// Subscribe to "office-chaione" tag and start receiving events from beacon and geofence elements with that tag
List<String> tags = Arrays.asList("office-chaione");
List<String> subscriptionTypes = Arrays.asList("beacon", "geofence");
SubscriptionProxy proxy = new SubscriptionProxy();
proxy.updateSubscriptions(SubscriptionOperation.ADD, tags, subscriptionTypes, new Callback<SubscriptionResponse>() {
@Override
public void onSuccess(SubscriptionResponse result) {
Toast.makeText(getActivity(), "Beacon and geofence subscriptions removed", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(Exception e) {
Toast.makeText(getActivity(), "Error removing beacon and geofence subscriptions", Toast.LENGTH_SHORT).show();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment