我让PushSharp成功向 Android、BB10 和 iOS 设备发送推送通知。我想向 WP8+ 设备发送通知,但似乎我没有成功注册 WindowsPhoneService。
这是我正在使用的代码:
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 相关事件中都没有任何断点。
我错过了什么?