Last active
August 29, 2015 14:09
-
-
Save CHLibrarian/5e6c22663d79a8cbfadd to your computer and use it in GitHub Desktop.
ContextHub Application Services Sending To Device (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
| // 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