Created
November 24, 2014 16:59
-
-
Save CHLibrarian/db77bcf21f55b8bf7a07 to your computer and use it in GitHub Desktop.
ContextHub Element Services Beacon 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 beacon with the name "Beacon 2" and adding the tag "park" | |
// In order to update a beacon, you need to pass in a valid beacon object | |
beacon.setName("Beacon 2"); | |
beacon.getTags().add("park"); | |
BeaconProxy proxy = new BeaconProxy(); | |
proxy.updateBeacon(beacon.getId(), beacon, 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