开发者

checking if rss feed has updated

I am writing an app for WP7 and would like to set up notifications for the client using the background services mango will be offering,

I was hoping to check whether an XML file or any file on the Web has updated or changed in any way, then alert the user using a push notification if it did.

I was thinking of checking the file's hash but I am unsure if that is even necessary and if there's another way of doing just that.

Is there anything you guys would advise me to do? I have my WCF Service keeping track of unique hardware IDs, so recording the client's last hash would be an开发者_运维技巧 idea and when this hash changes execute an operation on my WCF service that pushes a notification to the client.

I am looking for methods and information on how to go about dynamically notifying the clients.


If you have a WCF service running the check, you can always read the date of the last post and if it is different from the one that was registered prior to it, issue a push notification. It is much easier and more efficient to do the check on the server side than on the client side.

For what Claus is suggesting, you might do this:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.microsoft.com");
request.Method = "HEAD";
request.BeginGetResponse(new AsyncCallback(GetResult), request);


private void GetResult(IAsyncResult result)
{
    HttpWebRequest request = (HttpWebRequest)result.AsyncState;
    HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
}

Headers is the property you are looking for, but then again - the phone should only be notified when the RSS feed is updated, so run this on the server side and notify the phone when needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜