2012-02-01 75 views
0
/*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(); 

在pushclient怎么会那么同步的URI与Web服务在MSDN给出的描述缺乏进一步的信息获取URI的MPNS以返回到推送客户端。 那么,有没有人知道如何让我的应用程序使用Windows Phone的推送通知客户端将其URI发送到MPNS,iso需要手动将它们复制粘贴到我的Web应用程序中? Greetz GP创建通知通道时,Windows Phone 7的

回答

0

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

1

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

从“sdkToastNotificationCS”例如下面的代码片段显示的可能位置来存储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服务将通知推送给该用户。