Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save CHLibrarian/5e6c22663d79a8cbfadd to your computer and use it in GitHub Desktop.

Select an option

Save CHLibrarian/5e6c22663d79a8cbfadd to your computer and use it in GitHub Desktop.
ContextHub Application Services Sending To Device (Android)
// Send a push to 2 devices with IDs defined below
// Note: All device IDs are UUIDs, if a deviceID is not a valid UUID, then it is not a valid device ID
String deviceId1 = "20984403-690A-4098-8557-73B763F1DFFB";
String deviceId2 = "151E57AF-7E87-400F-A1E0-63C9E7811376";
SimplePushNotification notification = new SimplePushNotification("Test push notification message");
notification.getDeviceIds().add(deviceId1);
notification.getDeviceIds().add(deviceId2);
PushNotificationProxy proxy = new PushNotificationProxy();
proxy.sendSimplePushNotification(notification, new Callback<Object>() {
@Override
public void onSuccess(Object result) {
Toast.makeText(getActivity(), "Push notification sent", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(Exception e) {
Toast.makeText(getActivity(), e.toString(), Toast.LENGTH_SHORT).show();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment