I am making an app for my college where we have to parse RSS feed and display it. I am using SAX Parser to parse it and its working smoothly. Now I want two functionality in my app. First of all I want to run it as a service so that it may notify users about new events i.e new updates from RSS and how should I differentiate between the old RSS feed parsed and the new one so that I can show only the new updates.
Please give a overview on how can I implement these two things.
I don't know about the first question (how to make it a service) but I've done the second in a past life. The way I went about it was:
Compute the hash (sha1) from the title (you might want add other fields too)
Store the hash into a database along with time stamp
If the hash matches the entry in the database don't add it
if (3) fails add to database
Display everything in the database in descending order of timestamp (latest first)
Related
How can such scenario be implemented in a social app Android java. I have built my app with Firebase RTDB and I am retrieving the data into a Recycleview using collection.shufflelist too so that I get random data displayed.
How to add another condition to collection.shufflelist(); that will make the latest post show at the top in that same random order but post that are created within the last 24 hours should be randomly placed at the top.
I have tried to use the logic of
reference.child().orderChildBy(timestap).startAt(system.currentTime....).StopAt(1356890000...) but I only saved date into my database in Simple date format, YY-MM-DD.
So I cannot add another node to save timestamps because app already has installs in several users phone changing database structure or adding new nodes/child may affect the app.
My question now on this situation how possible is it to set my random retrieved data to have the latest at the top?
Iam currently developing an android e commerce application,were we have API to find/search products, but unfortunately the result are not correct/accurate.(Poor API).
So iam planning to download the entire list of products (Around 500-1000 products) as json file/format to device from server which consist of product_id and product_name and use some android auto complete method to search that product from json file.And i will keep flag whether new products have updated in backend , if so the json file get replaced.
**Is this a good method? Am i on right track. if not can you suggest some other methods and the procedure for doing AUTO Complete and product search.
Thanks in advance.
I want to write an app get the information from posts (mostly about new classes) on my university website then make some annoucement once there is new class.
I've google and see RSS mostly, but the page I want to get data does not use RSS. I read something about website using service so we can read XML in the app, but I don't know if the page using service or not. Last resort is using host (somee for example) and js to get text from the page, then the app could read data from the host.
That's all I have right now, but it's still unclear for me. Any suggestion about what to read, what should I use?? Much appreciation
I think the first thing you do should be to ask your uni if they provide any feed or webservice for these data that you could use.
If they don't, or don't answer at all, your last resort would be scraping. To do this, you can use an HTML parser, like jsoup, and then go through the HTML data, getting information as you need.
To see if there are been changes, you would just have to cache your current processed information, probably in a database, and compare the new one to the one currently saved.
I working on my app that uses "The movie database API".
This app just parse a json from the API and gets each movie information.
My question is what the better way to that.
First alternative is to build syncAdapter, check for updates each day for example, store all movies information on local database and update the UI from database.
Second alternative is just retrive the information from network on each request and update the UI.
Can anyone explain me wich way is better and why?
Absolutely the first alternative !!!!!
let's Suppose your app is used by thousand of users and you have chosen the second one .....oh poor server :)
I usualy create my own local database and syncronize it each "x" interval time depending on the type of information : if I have, for example, a list o category that I know they are rearly changed than I syncronize them each "2 days" ....For data that can be different more often I use 20 minutes and so on. This just avoid stressing server if the user goes in/out from your app.
Bye
i'm developing an android application which allows different users to login and see a list of favourite songs.
Each user has its list of songs, and a song is an instance of the corresponding class Song, with some attributes (singer, year, title...). The MainActivity contains the form for the login, so the user has to set its Name and Password. After login, a second activity is started, and it contains the ListView with the user's favourite songs.
How can i associate a single user to its corresponding song's list?
I thinked to use a database to store the songs, but then?
Look at Parse it's very easy to use and let you focus on your android App, instead of spending much time writing and configuring a server-side application.
You need also to implement on your android application a service to handle json ( or xml, it's your choice ). This is an awesome library to handle json JSONP.
Look also to this link for an overview on RESTfulservices.
For example (getting user info):
You need an info on userA.
You format a json with the right info.
Start an http request to your server. It will answer you with another json containing some info.
Parse this json recieved and use the data in your app.
I hope I made myself clear.