【问题标题】:PushSharp events not firing for WP8PushSharp 事件未针对 WP8 触发
【发布时间】:2014-06-17 13:32:14
【问题描述】:

我有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 相关事件中都没有任何断点。

我错过了什么?

【问题讨论】:

    标签: windows-phone-8 notifications pushsharp


    【解决方案1】:

    在最新版本的PushSharp中,有一个参数传递给“StopAllService”,用于等待停止前发送的队列:

    // push.StopAllServices(true);

    这将强制推送通道发送队列中的通知。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-16
      • 1970-01-01
      • 2021-10-21
      • 2019-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多