Get news from a site automatically

0

I'm creating an application and it will have the news part, how do I get it automatically from the posts on this site? as in the following application that I found on the internet.  He takes the picture of the post the title and a preview of the post, and when he clicks it sends to the site, could you help me? Thank you!

    
asked by anonymous 28.06.2017 / 20:06

2 answers

0

Basically you'll have to study the site's API and see how it returns the data (usually a JSON String) and if you need an application key to access it. Then you just have to implement routines to connect to the API, get JSON, parse it to get just the necessary data, define how to store that data (ArrayList, Database) and display them in a list (RecyclerView).

All these steps are not trivial to detail here. I gave you a minimal macro strategy, more like a checklist.

If you want to go deeper, this course details each item I've listed with some projects that do exactly what you want:

link

    
28.06.2017 / 20:30
3

You have two alternatives to solve this problem:

  • If you have developed the site that you want to get the information from, also develop a API I've sent you this information. To consume this API using Android, you can use the Volley library.
  • If you have not developed the site you want to get the information on, develop an crawler that you go through the site and save the information in a place that you can access with your app (it can also be an online API).
  • 28.06.2017 / 20:28