首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何将通知添加到我的新闻App ANDROID?

如何将通知添加到我的新闻App ANDROID?
EN

Stack Overflow用户
提问于 2015-10-23 14:10:00
回答 3查看 1.4K关注 0票数 2

我正在开发一个android新闻应用程序,它可以从谷歌新闻rss订阅中获取新闻。我目前正在获取新闻,并在我的应用程序中向用户显示它。但我想在google rss上出现新新闻时向用户显示通知。我不知道怎么做,因为我是android的新手,在google上找不到任何相关的东西。谢谢。

以下是我到目前为止所做的代码

代码语言:javascript
运行
复制
internal static List<FeedItem> GetFeedItems(string url)
        {

            List<FeedItem> feedItemsList = new List<FeedItem>();
            try
            {
                HttpClient wc = new HttpClient();

                var html = wc.GetStringAsync(new Uri(url)).Result;


                XElement xmlitems = XElement.Parse(html);
                // We need to create a list of the elements
                List<XElement> elements = xmlitems.Descendants("item").ToList();

                // Now we're putting the informations that we got in our ListBox in the XAML code
                // we have to use a foreach statment to be able to read all the elements 
                // Description  , Link , Title are the attributes in the RSSItem class that I've already added
                List<FeedItem> aux = new List<FeedItem>();
                foreach (XElement rssItem in elements)
                {
                    FeedItem rss = new FeedItem();

                    rss.Description = rssItem.Element("description").Value;
                    rss.Link = rssItem.Element("link").Value;
                    rss.Title = rssItem.Element("title").Value;
                    feedItemsList.Add(rss);

                }
            }
            catch (Exception)
            {
                throw;
            }
            return feedItemsList;
        } 
EN

回答 3

Stack Overflow用户

发布于 2015-10-23 14:27:53

使用parse的推送通知,它非常容易使用,并且有很棒的文档。https://parse.com

票数 1
EN

Stack Overflow用户

发布于 2015-10-23 14:15:41

转到推送通知服务。这是获得通知的唯一方法。

按照本教程..。http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/

票数 0
EN

Stack Overflow用户

发布于 2015-10-23 14:15:56

在这里,通知管理器就是你想要的。

看到这个http://developer.android.com/guide/topics/ui/notifiers/notifications.html了吗?

简单的google搜索也会显示相同的教程

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33295852

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档