2012-02-01 46 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服務將通知推送給該用戶。