public void SendPush(string deviceToken, string message, string baseurl) { if (!string.IsNullOrEmpty(deviceToken)) { var push = new PushBroker(); //Wire up the events for all the services that the broker registers push.OnNotificationSent += NotificationSent; push.OnChannelException += ChannelException; push.OnServiceException += ServiceException; push.OnNotificationFailed += NotificationFailed; push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired; push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged; push.OnChannelCreated += ChannelCreated; push.OnChannelDestroyed += ChannelDestroyed; try { string ss = HostingEnvironment.MapPath(@"~\Resources\Certificates2.p12"); var appleCert = File.ReadAllBytes(ss); push.RegisterAppleService(new ApplePushChannelSettings(false, appleCert, "123")); push.QueueNotification(new AppleNotification() .ForDeviceToken(deviceToken)//the recipient device id .WithAlert(message)//the message .WithBadge(5) .WithSound("snap audio alert.mp3") // .WithSound("default") ); } catch (Exception ex) { throw ex; } } }
Application_End
StopAllServices
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)