Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

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

Select an option

Save CHLibrarian/d9dabae73866762912b0 to your computer and use it in GitHub Desktop.
ContextHub Application Services Sending To Tags (Android)
// Send a push notification to all devices with tags "tag1" and "tag2"
// Note: If a device has both "tag1" and "tag2", they will receive the same notification twice
String tag1 = "tag1";
String tag2 = "tag2";
SimplePushNotification notification = new SimplePushNotification("Test push notification message");
notification.getTags().add(tag1);
notification.getTags().add(tag2);
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