通过WNS和OneSignal为UWP App推送通知时出错

时间:2018-10-28 17:03:54

标签: c# push-notification uwp onesignal wns

我正在尝试使用OneSignal在我的UWP App中获取推送通知。 我已经从Live Service中获得了应用程序秘密和程序包SID(并且已在OneSignal仪表板上注册了该信息)。 在[Windows UWP] [1]的文档中,我应该将带有推送令牌的设备注册为标识符(并将device_type设置为6)。

我已经用此代码获取了频道uri

PushNotificationChannel pushNotificationChannel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();

并在OneSignal上成功注册了设备...但是当我尝试创建通知时,出现以下错误(来自OneSignal服务):

{
"id": "",
"recipients": 0,
"errors": [
    "All included players are not subscribed"
],
"warnings": [
    "Windows Platform Errors: (Invalid Windows credentials) Windows rejected the request for an authentication token due to invalid credentials. Please check that your credentials are correct."
]

}

我试图用仅分配给从通道uri提取的令牌的标识符以及整个通道uri来注册设备。但是我总是会遇到同样的错误。

有人在WNS和OneSignal上有经验吗?

从OneSignal此处获取设备的JSON:

{
        "id": "cce63....",
        "identifier": "https://db5p.notify.windows.com/?token=AwYAAAB0h....",
        "session_count": 1,
        "language": "it",
        "timezone": null,
        "game_version": null,
        "device_os": null,
        "device_type": 6,
        "device_model": null,
        "ad_id": null,
        "tags": {},
        "last_active": 1540676034,
        "playtime": 0,
        "amount_spent": 0,
        "created_at": 1540676034,
        "invalid_identifier": false,
        "badge_count": 0,
        "sdk": null,
        "test_type": null,
        "ip": null
    }

谢谢

致谢

1 个答案:

答案 0 :(得分:0)

与我的同事交谈时,他已经配置了OneSignal,我发现在OneSignal配置中输入了“应用秘密”。 在更正了App Secret之后,很明显它可以正常工作。