Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

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

Select an option

Save CHLibrarian/8f369dfe08629a0f4e3c to your computer and use it in GitHub Desktop.
ContextHub Application Services Sending To Alias (Android)
// Send a push notification to 2 devices, with aliases "Andy's Moto X" and "Chris' Nexus 5"
String alias1 = "Andy's Moto X";
String alias2 = "Chris' Nexus 5";
SimplePushNotification notification = new SimplePushNotification("Test push notification message");
notification.getAliases().add(alias1);
notification.getAliases().add(alias2);
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