简体   繁体   中英

RSS Notification Android Application

Hello everyone I know this has probably has been asked a lot and I have tried to search but can't find the answers I'm looking for.

I'm trying to build a application for Android and iOS where the user can download the app and once its downloaded everytime there is a new article on the blog it will give the user a notification and when they click on the notification it will take them to the browser of their choice and to the blog article on the web.

I was just wondering what the best way to do this is without having to use a third party.

Basically in a nut shell, just a application that syncs up with the RSS evey so often and if there is a new article it would give them a notification that links to the new blog article on the web.

as for the actual visual of the app i was just going to put some information and maybe what time intervals to sync with the RSS.

If any of this didn't make since please tell me and ill try to explain it better.

Thanks everyone for the help in advance,

Zach

I have made an app like this for Android, it's called "Toggelis Newsreader". You need to parse the incoming Rss feed with a sax parser for example, keep track of the news the user already read, keep a list of feeds the user wants to follow etc. As for the update intervals, I let the user chose 15min, 30min, 1h etc or "auto". Auto adapts the frequency to the sites activity: frequent new infos --> interval down and vice versa. You should not permit intervals < 15min as this could be perceived as aggressive by the scanned sites.

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流中有一些新项,则我粘贴的代码是在解析过程结束时应调用的方法。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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