【问题标题】:Get the URI the MPNS to returns to the push client when creating a notification channel Windows Phone 7在创建通知通道 Windows Phone 7 时获取 MPNS 返回到推送客户端的 URI
【发布时间】:2012-02-01 09:58:14
【问题描述】:
/*Get the URI that the Microsoft Push Notification Service returns to the Push Client when creating a notification channel.
Normally, a web service would listen for URIs coming from the web client and maintain a list of URIs to send                
notifications out to. */

string subscriptionUri = TextBoxUri.Text.ToString();

MSDN 上给出的描述中缺少关于推送客户端如何将 URI 与 web 服务同步的更多信息。 那么,有谁知道如何让我的应用程序使用 Windows Phone 的推送通知客户端将其 URI 发送到 MPNS,iso 必须手动将它们复制粘贴到我的 Web 应用程序中? 格雷茨GP

【问题讨论】:

    标签: client-server push-notification windows-phone-7.1 mpns


    【解决方案1】:

    请参阅 MSDN Windows Phone 代码示例,网址为: http://msdn.microsoft.com/en-us/library/ff431744(v=vs.92).aspx

    “sdkToastNotificationCS”示例中的以下代码 sn-p 显示了存储 uri 或发送到您的 web 服务的可能位置:

    void PushChannel_ChannelUriUpdated(object sender, NotificationChannelUriEventArgs e)
        {
    
            Dispatcher.BeginInvoke(() =>
            {
                // Display the new URI for testing purposes.   Normally, the URI would be passed back to your web service at this point.
                System.Diagnostics.Debug.WriteLine(e.ChannelUri.ToString());
                MessageBox.Show(String.Format("Channel Uri is {0}",
                    e.ChannelUri.ToString()));
                // Instead of showing the URI in a message box, POST to your web service
    
            });
        }
    

    执行 HTTP POST 请求以发送 URI 和您推送用户的标识符。在您的 Web 服务上接收此 POST 数据并存储用户/URI,以便您可以从您的 Web 服务向该用户推送通知。

    【讨论】:

      【解决方案2】:

      您只需要在您的服务器上有一个端点,应用程序可以将 PNS uri(和任何其他相关信息)发送到该端点。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-10-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多