Skip to content

Instantly share code, notes, and snippets.

@CHLibrarian
Last active August 29, 2015 14:10
Show Gist options
  • Save CHLibrarian/41b57e8adda63d3cdc8d to your computer and use it in GitHub Desktop.
Save CHLibrarian/41b57e8adda63d3cdc8d to your computer and use it in GitHub Desktop.
ContextHub Element Services Beacon Create (Android)
// Creating a beacon region with name "Beacon", tag "beacon-tag"
BeaconProxy proxy = new BeaconProxy();
proxy.createBeacon("Beacon", "B9407F30-F5F8-466E-AFF9-25556B57FE6D", 100, 1, new String[]{"beacon-tag"},
new Callback<Beacon> {
@Override
public void onSuccess(Beacon result) {
// If you do not have push properly set up, you need to explicitly call synchronize on ProximityService so it will generate events for this device
ProximityService.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