0

我正在开发一个带有 PHP 服务的 winrt Windows 8.1 应用程序。使用链接中给出的代码(https://www.codeproject.com/Articles/1089935/Send-Push-Notifications-to-Windows-Phone-App-Using),我们在客户端和服务器中都开发了推送通知服务结尾。但我们没有在设备上收到任何通知。到目前为止,我们遵循的步骤如下:

1. 启用 Toast Capable 选项 在此处输入图像描述

2.增加后台任务(推送通知)

在此处输入图像描述

3.注册一个频道uri,发送到服务器发送push。

private void CreateUri()
    {
        string notificationUrl;
        var channel = Task.Run(async () => await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync()).Result;
        channel.PushNotificationReceived += channel_PushNotificationReceived;
        //localSettings.Values["ChannelUri"] = channel.ToString();
        notificationUrl = channel.Uri.ToString();
        var result = Task.Run(async () => await this.regPush.GetPushNotifRegID(this.customerId, notificationUrl)).Result;
        RegisterBackgroundTask();
    }

我们有一个这样的频道uri:https ://hk2.notify.windows.com/?token=AwYAAAC8OZsKv0lulse+lxPQF7NGostwaolxwNWgXqfw1Ed8Pm1hySMyCQuMARKiNhFQ0bCm5D1esKgnIcl8qw/ahP+b4Q6nU0HSouzHKvg38x30p+VytSWLCETX=nh

4. 使用这个频道uri,我们在向WNS注册应用程序并获取accessToken后发送推送

{
"token_type": "bearer",
"access_token": "EgCbAQMAAAAEgAAADAABBEZezsYWE3v6nE/0SKOxQv66Dlcs0WZP2zCZJl0xIV246+nqQpkQHBcmMz0tAaqCe/OtcO/WF1OTuuubyWVcyNnANtFSL0XS2oPSRWA55ZwkK+D4tHrR/i2RHvCqL+QaDLG7wUT5Lw+4DFnVYXbcrJyZoYaTDYHvNk4/dYERpTjTpEYRJw+t+7L77HJHCf4oLg9VKWoUTqLzv/ycQfkX09/FHyTHaDRxKRvy3qCwAGL1o3VeNJ1P076Q883nZbIpWsWXCOyuUjIHo86DNju/a/c44fo3BS+W9IzcwBRKIvFnKfPxlg2s+/02L1972x46rwhK6XYDYR2vM+uX4R0wtooAWgCKAAAAAAADDhpEv4J4WL+CeFjrSAQADQA1Mi42Ni45MC4xNDAAAAAAAF0AbXMtYXBwOi8vcy0xLTE1LTItMzMxNzk5MzY4OC0zNzExMDMyODMyLTM4NzIzMzA1NS03NjgwMTk5NTQtNDE3Mzg4NjI1MC0xMDI4MTQwMjk0LTIwMDQwODgwNTUA",
"expires_in": 86400}

这些我们都做了,但我们没有收到来自服务器的任何推送。对此的任何帮助将不胜感激。提前致谢。

4

0 回答 0