Skip to content

Instantly share code, notes, and snippets.

@sunnyy02
Last active July 22, 2018 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunnyy02/d985bd9e8917a237384cf97ddf125a7e to your computer and use it in GitHub Desktop.
Save sunnyy02/d985bd9e8917a237384cf97ddf125a7e to your computer and use it in GitHub Desktop.
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