Last active
July 22, 2018 06:22
-
-
Save sunnyy02/d985bd9e8917a237384cf97ddf125a7e to your computer and use it in GitHub Desktop.
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
var certificateFilePath = "C:\\dev\\PushNotificationDemo\\cert.p12"; | |
var certificatePassword = ""; // We keep password empty | |
var config = new ApnsConfiguration (ApnsConfiguration.ApnsServerEnvironment.Sandbox,certificateFilePath, certificatePassword); | |
var broker = new ApnsServiceBroker (config); | |
broker.OnNotificationFailed += (notification, exception) => { | |
failed++; | |
}; | |
broker.OnNotificationSucceeded += (notification) => { | |
succeeded++; | |
}; | |
broker.Start (); | |
foreach (var dt in Settings.Instance.ApnsDeviceTokens) { | |
attempted++; | |
broker.QueueNotification (new ApnsNotification { | |
DeviceToken = dt, | |
Payload = JObject.Parse ("{ \"aps\" : { \"alert\" : \"Hello PushSharp!\" } }") | |
}); | |
} | |
broker.Stop (); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment