Starting from:

$30

Assignment 5 News Gateway Solution

Uses: Service, Broadcasts & Receivers, Drawer Layout, Fragments, ViewPager, Internet, APIs







App Highlights:




This app displays current news articles from a wide variety of news sources covering a range of news categories.



NewsAPI.org will be used to acquire the news sources and news articles.



Selecting a news source will display up to 10 top stories from that news source



Selecting a news category will limit the news source choices to only those offering that category of news.



News articles are viewed by swiping right to read the next article, and left to go back to the previous article



You will not need to develop separate landscape layouts



The user can go to the complete extended article on the news source’s website by clicking on the article title, text, or image content.



You must add a professional looking launcher icon to your app.






NO LATE SUBMISSIONS WILL BE ACCEPTED FOR THIS ASSIGNMENT




Application Architecture:







App/Activity






Service
Broadcast Request




For News Article
API GET
Broadcast


NewsAPI.org
JSON Data
News Article Data










Receives Broadcast

Requests for News

Receives News Article

Articles




Request List of News

Sources via AsyncTask

Development (Android Section)




A) News Data:




Acquiring news source and news article data will be done via the NewsAPI.org news aggregation service. This service allows you to download news sources (all or by news type/category) and news articles (by news source)




NOTE: You MUST sign up get an API key in order to access the NewsAPI.org services. Your API KEY must be supplied with NewsAPI.org queries. You can do this by registering at:




https://newsapi.org/register




Register with an email and a new password and agree to the terms and click Submit to register and get your API key (the key is displayed to you right after you click the Submit button).







The API:




The NewsAPI.org service offers 2 API calls – one to get news sources (organizations offering news – CNN, Time, etc.) and one to get top news articles from a selected news source.







News Sources Query Format (to be used in our assignment): To get all sources: https://newsapi.org/v2/sources?language=en&country=us&category=________&apiKey=________



Note, using an empty string for the category will return source for all categories.







For example, if your category was “business” and your API Key was “ABC123xyz”, the URL would be: https://newsapi.org/v2/sources?language=en&country=us&category= business &apiKey= ABC123xyz







News Article Query Format (to be used in our assignment): https://newsapi.org/v2/everything?sources=______&language=en&pageSize=100&apiKey=______



For example, if your API Key was “ABC123xyz” and you wanted “cnn” news, the URL would be: https://newsapi.org/v2/everything?sources=cnn&language=en&pageSize=100&apiKey= ABC123xyz
















NO LATE SUBMISSIONS WILL BE ACCEPTED FOR THIS ASSIGNMENT











































NewsAPI.org Sources Query Results Example:




https://newsapi.org/v2/sources?language=en&country=us&category=&apiKey= ABC123xyz




The results come in the form of a JSON Object that contains a JSON Array of source entries as shown below. Each entry represents an individual news source. Example:




{




"status": "ok",




"sources": [{




"id": "abc-news",




"name": "ABC News",




"description": "Your trusted source for breaking news, analysis, exclusive interviews, headlines, and videos at ABCNews.com.",




"url": "https://abcnews.go.com",




"category": "general",




"language": "en",




"country": "us"




}, {




"id": "al-jazeera-english",




"name": "Al Jazeera English",




"description": "News, analysis from the Middle East and worldwide, multimedia and interactives, opinions, documentaries, podcasts, long reads and broadcast schedule.",




"url": "http://www.aljazeera.com",




"category": "general",




"language": "en",




"country": "us"




}, {




"id": "ars-technica",




"name": "Ars Technica",




"description": "The PC enthusiast's resource. Power users and the tools they love, without computing religion.",




"url": "http://arstechnica.com",




"category": "technology",




"language": "en",




"country": "us"




}, {




. . .




}]




}




NO LATE SUBMISSIONS WILL BE ACCEPTED FOR THIS ASSIGNMENT




Development (Android Section)




NewsAPI.org Articles Query Results Example:




https://newsapi.org/v2/everything?sources=cnn&language=en&pageSize=100&apiKey= ABC123xyz




The results come in the form of a JSON Object that contains a JSON Array of article entries as shown below. Each entry represents an individual news article. Example:




{




"status": "ok",




"totalResults": 4773,




"articles": [{




"source": {




"id": "cnn",




"name": "CNN"




},




"author": "Kristina Marusic, CNN",




"title": " Anatomy of a Pride parade ",




"description": " Pride parades have been with us for decades now. Let's look back at their history and the wide variety of people -- from drag queens to church representatives -- who are in them.",




"url": " https://www.cnn.com/travel/article/pride-parades-history/index.html",




"urlToImage": "https://dynaimage.cdn.cnn.com/cnn/w_1200/http%3A%2F%2Fcdn.cnn.com% 2Fcnnnext%2Fdam%2Fassets%2F190322082046-05-pride-parade-explainer-photos-super-tease.jpg",




"publishedAt": " 2019-04-15T14:42:45Z",




"content": "(CNN) Glitter, rainbows, costumes and corporate logos: At first glance, Pride parades may appear to just be one big party. But peek beneath the surface, and you'll discover that Pride is celebrated by a diverse network of groups, each with their own rich hist… [+10486 chars]"




}, {




"source": {




"id": "cnn",




"name": "CNN"




},




"author": null,




"title": " 2020 first-quarter fundraising totals released",




"description": " Today is the last day for campaigns to file Federal Election Commission disclosure reports with full details of their fundraising. Follow here as we learn the candidates' first-quarter fundraising totals.",




"url": " https://www.cnn.com/politics/live-news/first-quarter-fundraising-totals-04-15-19/index.html",




"urlToImage": " https://cdn.cnn.com/cnnnext/dam/assets/190410160852-20190411-2020-




democrat-power-rankings-april-super-tease.jpg",




"publishedAt": "2019-04-15T13:43:48Z",




"content": " Not only is it Tax Day, but Monday also is the deadline for presidential and congressional candidates to file reports with the Federal Election Commission, detailing their fundraising and spending during the first three months of the year.\r\nThis marks the fir… [+910 chars] "




}, {




. . .




}]




}




© Christopher Hield
4 of 10



Application Behavior Diagrams:



Overview









The selected news source is displayed in the Navigation Bar




News articles from the selected source are displayed in a “view pager” allowing left & right-swipe navigation between articles.







Article count is maintained at the bottom of the screen































© Christopher Hield

CS 442 Mobile Applications







Development (Android Section)






















A News category (i.e.,




“business”) can be




selected using the options

menu







A News Source (i.e., “cnn”) can be selected by opening the “drawer” and selecting a source



















news-related background is shown before any articles are loaded




























































News Article Headline




News Article Image




News Article Date




News Article Author(s)




News Article Text



















5 of 10

CS 442 Mobile Applications




Development (Android Section)




2) Selecting a news source:
















3) Swipe Right (or Left) to scroll through articles from the selected new source:










Swipe




Development (Android Section)







Select a news category from the options menu to limit the news source choices to only those offering that category of news.









News sources list with “technology” category







5) Click on article content to go to extended article on the news source web site







C) Application Content:










News Source

Downloader














































category


Source LIst








NewsFragment




































































































NewsFragment








NewsReceiver
MainActivity


ViewPager








NewsFragment


































NewsFragment












































NewsFragment















































































































News Story LIst






News Source Request
NewsService
ServiceReceiver


Story LIst
Source




ServiceThread


News Article




Downloader









NO LATE SUBMISSIONS WILL BE ACCEPTED FOR THIS ASSIGNMENT













Extra Credit:



Up to 20 points of extra credit will be awarded if you save and restore the app state when transitioning between portrait and landscape layouts to ensure a smooth user experience. Without this, the app reverts to the start state upon rotation. If this is done properly, the current category selection, the current source list (in the drawer), and the displayed articles will be maintained upon device orientation change.









Up to 25 points of extra credit will be awarded if you display the news categories in the options menu different colors, and then color the news sources in the drawer according to their category:



Options menu example: Drawer list of news sources: example










Assignment Assistance




The TAs for our course is available to assist you with your assignment if needed. Questions on assignment requirements and course concepts can be sent to the instructor.







NO LATE SUBMISSIONS WILL BE ACCEPTED FOR THIS ASSIGNMENT







Submissions & Grading




Submissions must consist of your zipped project folder (please execute Build =Clean Project before generating the zip file).



Submissions should reflect the concepts and practices we cover in class, and the requirements specified in this document.



NO LATE SUBMISSIONS WILL BE ACCEPTED FOR THIS ASSIGNMENT



Grading will be based upon the presence and proper functionality of all features and behaviors described in this document.
























NOTE




This assignment is worth 450 points. This means (for example) that if you get 89% on this assignment, your recorded score will be:




(89% * 450 points = 401 points)







If you do not understand anything in this handout, please ask.







Otherwise the assumption is that you understand the content.







Unsure? Ask!
















NO LATE SUBMISSIONS WILL BE ACCEPTED FOR THIS ASSIGNMENT













































































































© Christopher Hield
10 of 10

More products