【问题标题】:WP7 Push notifications not working after app has been published应用程序发布后 WP7 推送通知不起作用
【发布时间】:2012-12-20 16:34:15
【问题描述】:

我正在为我的手机应用程序使用 Toast 通知。当应用程序首次在某人的手机上启动时,它将获取推送通知 URL,然后将其存储在我们的数据库中,以便我们可以将通知发送给用户。

在测试中,使用模拟器和在我的 HTC WP7 上进行测试,发现并上传了通知。

现在应用程序在商店中,通知 URL 将作为 NULL 到达服务器。在应用仪表板中,我得到以下信息:

缺少经过身份验证的推送通知的证书:经过身份验证的推送通知的证书

这会导致问题吗?如果是这样,我该如何获得这个证书?我在任何地方都找不到与此相关的任何内容。

下面是一个代码 sn-p,它在测试中有效,但由于发布到商店总是返回 NULL:

private void BindChannel()
    {
        channel = HttpNotificationChannel.Find(channelName);

        if (channel == null || channel.ChannelUri == null)
        {
            if (channel != null) DisposeChannel();

            channel = new HttpNotificationChannel(channelName);
            channel.ChannelUriUpdated += channel_ChannelUriUpdated;
            channel.Open();
        }
        else
        {
            StorageSettings.StoreSetting("NotifyURL", channel.ChannelUri.AbsoluteUri); 
        }

        SubscribeToChannelEvents();

        if (!channel.IsShellTileBound) channel.BindToShellTile();
        if (!channel.IsShellToastBound) channel.BindToShellToast();

        string notificationUri = string.Empty;

        if (StorageSettings.TryGetSetting<string>("NotifyURL", out notificationUri))
        {
            if (notificationUri != channel.ChannelUri.AbsoluteUri)
            {
                StorageSettings.StoreSetting("NotifyURL", channel.ChannelUri.AbsoluteUri);
            }
        }
        else
        {
            if (channel.ChannelUri != null)
            {
                StorageSettings.StoreSetting("NotifyURL", channel.ChannelUri.AbsoluteUri);
            }
        }

    }

【问题讨论】:

    标签: windows-phone-7 push-notification toast mpns


    【解决方案1】:

    实际上我也得到了空 url,但在我这边,它的 WNS 在一段时间后没有响应它会正常工作。

    我认为下面的链接可能会对你有所帮助

    Overview of pushnotification

    How to authenticate with the Windows Push Notification Service (WNS) (Windows)

    【讨论】:

      猜你喜欢
      • 2014-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-14
      • 1970-01-01
      相关资源
      最近更新 更多