-
-
Save matzew/3d7f9915afd8f6705da5 to your computer and use it in GitHub Desktop.
Push for different mobile OS versions, for one "server" Push app...
This file contains 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
@Test | |
public void sendNotificationTo_iOS_and_Android() { | |
// CREATE push app: | |
PushApplication pa = new PushApplicationImpl(); | |
pa.setDescription("Test Push App"); | |
pa.setName("All The Thingz"); | |
// iOS app: | |
iOSApp pusher = new iOSApp(); | |
pusher.setAppleAppId("net.wessendorf.Pusher"); | |
pusher.setCertificate("/path/to/cert.p12"); | |
pusher.setPassphrase("foo"); | |
// add the iOS app: | |
pa.addMobileApplication(pusher); | |
// android app: | |
AndroidApp todoApp = new AndroidApp(); | |
todoApp.setGoogleAPIKey("SOME-AWESOME-KEY"); | |
// add the Android app: | |
pa.addMobileApplication(todoApp); | |
// register Push-App it with "server": | |
pushMgr.registerPushApplication(pa); | |
// send the message to all devices/mobile apps, for this Push app" | |
Sender sender = new SenderImpl(); | |
sender.sendMessageToApplications("Yo, dude!", pushMgr.getPushApplications()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment