locked
rss.xml feeds Updates

    Question

  •  

    hi everyone ,

          I wanna know how to update the rss feeds in windows phone applcation ,I have developed a rss news reader in blend But the news data is same as was first time .I wanna update the news everyone when app launched on users phone.

      plzzz someone help me out ..

     


    Crazy learner

    Tuesday, January 27, 2015 2:15 PM

Answers

  • Hi Muhammad Suffian,

    Based on my knowledge, RSS feed will update automatically according the web site like this CNN top stories RSS feed. http://rss.cnn.com/rss/edition.rss. When you app launch, you should read the RSS feed again and to find the new updated content, then upgrade to your XAML control. I created some code snippet for you. Please modify to meet your requirement. Note that my code snippet is for windows phone 8.1 runtime app, if you are using silverlight app, please find the corresponding classes to use.     

       protected override void OnNavigatedFrom(NavigationEventArgs e)
    
            {
    
                //get rss contnet 
    
                DownloadRSSData();
    
                //check if there is some new rss content
    
                FindNewFromRSSDataAndDisplay();
    
            }
    
    
            private async void DownloadRSSData()
    
            {
    
                HttpClient client = new HttpClient();
    
                var rssstring = await client.GetStringAsync("http://rss.cnn.com/rss/edition.rss");
    
                SyndicationFeed feed = new SyndicationFeed();
    
                feed.Load(rssstring);
    
                var rssdata = feed.Items.ToList();
    
                list = new List<RSSContent>();
    
                //convert xml to RSSContent object list
    
            }
    
            private void FindNewFromRSSDataAndDisplay()
    
            {
    
                //find the previous rss contnet, we can save them in local settings.
    
                List<RSSContent> lastsavedone = new List<RSSContent>();
    
                if (Windows.Storage.ApplicationData.Current.LocalSettings.Values.ContainsKey("LastSavedRSSContent"))
    
                {
    
                    lastsavedone = Windows.Storage.ApplicationData.Current.LocalSettings.Values["LastSavedRSSContent"] as List<RSSContent>;
    
                }
    
                //find the differens between the last one and the newer one
    
     
    
    
                //display the new comming contnet in XAML
    
    
    
                //save the new one to LastSavedRSSContent in local setting 
    
    
            }
    

        public class RSSContent
    
        {
    
            public string URL { get; set; }
    
    
            public string Title { get; set; }
    
    
            public DateTime RetrieveTime { get; set; }
    
    
            //other properties
    
        }
    

    Feel free to let me know if I have any misunderstanding.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Wednesday, January 28, 2015 5:49 AM
    Moderator