Windows phone 8 未为WP8触发PushSharp事件
我已成功向Android、BB10和iOS设备发送推送通知。我想向WP8+设备发送通知,但似乎我所做的任何事情都无法成功注册WindowsPhone服务 以下是我正在使用的代码:Windows phone 8 未为WP8触发PushSharp事件,windows-phone-8,notifications,pushsharp,Windows Phone 8,Notifications,Pushsharp,我已成功向Android、BB10和iOS设备发送推送通知。我想向WP8+设备发送通知,但似乎我所做的任何事情都无法成功注册WindowsPhone服务 以下是我正在使用的代码: PushBroker push = new PushBroker(); push.OnNotificationSent += NotificationSent; push.OnChannelException += ChannelException; push.OnServiceException += Service
PushBroker push = new PushBroker();
push.OnNotificationSent += NotificationSent;
push.OnChannelException += ChannelException;
push.OnServiceException += ServiceException;
push.OnNotificationFailed += NotificationFailed;
push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
push.OnChannelCreated += ChannelCreated;
push.OnChannelDestroyed += ChannelDestroyed;
push.RegisterWindowsPhoneService();
WindowsPhoneToastNotification windowsPhoneToastNotification = new WindowsPhoneToastNotification()
.ForEndpointUri(new Uri([[Device Uri]]))
.ForOSVersion(WindowsPhoneDeviceOSVersion.Eight)
.WithBatchingInterval(BatchingInterval.Immediate)
.WithNavigatePath("/MainPage.xaml")
.WithText1("Test 1")
.WithText2("Test 2")
;
push.StopAllServices();
一切都非常简单,但不会发送通知,也不会触发任何事件。没有什么我可以一直点击断点到“push.StopAllServices();”,但在任何PushSharp相关事件中都不能点击断点
我缺少什么?在最新版本的PushSharp中,有一个参数要传递给“StopAllService”,用于在停止之前等待发送的队列: // push.StopAllServices(true) 这将强制pushchannel发送队列中的通知