繁体   English   中英

RSS通知Android应用程序

[英]RSS Notification Android Application

大家好,我知道这个问题可能已经被问了很多,我已经尝试搜索,但是找不到我想要的答案。

我正在尝试为Android和iOS构建一个应用程序,用户可以在其中下载该应用程序,并且每次在博客上有新文章时,一旦下载该应用程序,它将向用户发送通知,当他们单击该通知时,它将带给他们他们选择的浏览器和网络上的博客文章。

我只是想知道什么是最好的方法,而不必使用第三方。

基本上,总而言之,只是一个经常与RSS evey同步的应用程序,如果有新文章,它将给他们一个通知,该通知链接到Web上的新博客文章。

至于应用程序的实际视觉效果,我只是要放置一些信息,以及可能与RSS同步的时间间隔。

如果自从那以后没有成功,请告诉我,请尝试更好地解释一下。

谢谢大家的帮助,

扎克

我已经为Android开发了一个这样的应用程序,它叫做“ Toggelis Newsreader”。 例如,您需要使用sax解析器解析传入的Rss feed,跟踪用户已经阅读的新闻,保留用户想要关注的feed列表等。至于更新间隔,我让用户选择了15分钟, 30分钟,1小时等或“自动”。 自动调整频率以适应站点活动:频繁的新信息->下调间隔,反之亦然。 您不应允许间隔<15分钟,因为这可能被扫描的站点视为侵略性的。

private void notif(String message, int icon, boolean autoClosing) {
    final Uri sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    final NotificationCompat.Builder nBuilder = new NotificationCompat.Builder(this).setSmallIcon(icon).setContentTitle("Toggelis Newsreader").setContentText(message);
    // Creates an explicit intent for an Activity in your app
    final Intent resultIntent = new Intent(this, AndroidAnzeige.class);

    final TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
    // Adds the back stack for the Intent (but not the Intent itself)
    stackBuilder.addParentStack(AndroidAnzeige.class);
    // Adds the Intent that starts the Activity to the top of the stack
    stackBuilder.addNextIntent(resultIntent);
    final PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
    nBuilder.setContentIntent(resultPendingIntent);
    final long[] pattern = { 0, 500 };
    if (isVibrate())
        nBuilder.setVibrate(pattern);
    if (isSound())
        nBuilder.setSound(sound);
    nBuilder.setAutoCancel(autoClosing);
    final NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    // mId allows you to update the notification later on.
    mNotificationManager.notify(1, nBuilder.build());
}

如果您检测到RSS流中有一些新项,则我粘贴的代码是在解析过程结束时应调用的方法。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM