Closed deshanonline closed 5 years ago
This app fetches data from the Internet with the Guardian API, so it only displays Guardian news.
how can i add the costom newa on this app
There's no feature that you can add custom news
Can I use it to display news from a respective news web site? The site generates data in JSON format what can be modified from your app to achieve this?
I'm sorry, but you cannot use this app to display news from a respective news web site. When I was building this app, I learned how to make an app that connects to the Internet in the Udacity course. The main idea of the code about Networking belongs to Udacity. The UI design is my idea though. The purpose of this repository is to help other Udacians, classmates of Udacity.
Can you share me Guardian business URL, as i am getting confuse NewsPreferences.java class.
The base URL is "https://content.guardianapis.com/search" and then append query parameters using .appendQueryParameter
.
You don't need to use all that query parameters that I used, but show-tags=contributor
shows author name and show-fields=thumnail
shows the images.
order-by, page-size, order-date, from-date are query parameters for preferences.
You may want to take a look at the requests and responses from the Guardian API: https://open-platform.theguardian.com/explore/
Hi, Here is the URL: https://newsapi.org/v2/top-headlines?country=in&category=business&apiKey=7ff1a4bf6f8541a8b8036d79a959a426 which i want to build. Well i am unable to append the URL with the same method which you used. please help me to clear this.
Hi, Uri baseUri = Uri.parse("https://newsapi.org/v2/top-headlines"); Uri.Builder uriBuilder = baseUri.buildUpon(); uriBuilder.appendQueryParameter("country", "in") uriBuilder.appendQueryParameter("category", "business"); uriBuilder.appendQueryParameter("apiKey", "7ff1a4bf6f8541a8b8036d79a959a426");
String url = uriBuilder.toString();
Let me know how it goes.
Hi, Please check as in my case apikey comes at the end of the URL and category='business' comes before the apikey, where i am unable to return Category (uriBuilder.appendQueryParameter(SECTION_PARAM, section).toString();) in getPreferrelUrl method and call that in Fragment.java NewsPreferences.getPreferredUrl(getcontext(),getString(R.string.bussiness));.
Well i am trying to create separate fragment for each category like
Guardian
https://content.guardianapis.com/search?q=&order-by=newest&page-size=10&order-date=published& from-date=2010-01-01&show-fields=thumbnail,trailText&format=json&show-tags=contributor&api-key=test§ion=business
Newsapi
Please find the url and help me to solve the issue.
Hi, Did you replace SECTION_PARAM with "category"? Could you please share your code snippet?
How to Add Other News Site