string certPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "nlcprod.p12"); bool exist = File.Exists(certPath); var cert = File.ReadAllBytes(certPath); var appleSettings = new PushSharp.Apple.ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Production, cert, ""); var pushBroker = new PushSharp.Apple.ApnsServiceBroker(appleSettings); pushBroker.OnNotificationFailed += (notification, aggregateEx) => { string strEx = aggregateEx.ToString(); }; pushBroker.OnNotificationSucceeded += PushBroker_OnNotificationSucceeded; // PushSharp.Apple.ApnsServiceConnection connection = new ApnsServiceConnection(appleSettings); JObject jObject = JObject.Parse(str); ApnsNotification apnsNotification = new ApnsNotification { DeviceToken = "97056623 0caedd1c 0c96a264 f16cbf57 d9fa7236 08046144 6160ee95 94616364", Payload = JObject.Parse("{\"aps\":{\"badge\":1,\"sound\":\"oven.caf\",\"alert\":\"testmessage\"}}") }; //connection.Send(apnsNotification); pushBroker.Start(); pushBroker.QueueNotification(apnsNotification);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)