[英]how to add push notifications in my existing android app using pushbots
[英]How can I add notifications to my news App ANDROID?
我正在开发一个 android 新闻应用程序,它从谷歌新闻 rss 提要获取新闻。 我目前正在获取新闻并将其显示给我的应用程序中的用户。 但是我想在 google rss 上出现新新闻时向用户显示通知。 我不知道该怎么做,因为我是 android 新手,在谷歌上找不到任何相关内容。 谢谢你。
这是我到目前为止所做的代码
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;
}
使用parse的推送通知,非常好用,文档丰富。 https://parse.com
去推送通知服务。 这是获得通知的唯一途径。
通知管理器就是您想要的。
看到这个http://developer.android.com/guide/topics/ui/notifiers/notifications.html ?
一个简单的谷歌搜索也显示了相同的教程
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.