CS 442 Assignment 6 – News Gateway

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment

Description

5/5 - (6 votes)

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.
• You will not need to develop separate landscape layouts but you will need to save and restore the app
state when transitioning between portrait and landscape layouts to ensure a smooth user experience
• Selecting a news source will display news articles from the selected news source
• Selecting a news category will limit the news source choices to those offering that category of news.
• News articles can viewed by swiping right to read the next article, and left to go back to the previous
article
Application Architecture:
Broadcast Request
For News Source
Data
Broadcast Request
For News Article
Data
Broadcast
News Source Data
Broadcast
News Article Data
NewsAPI.org
Service
App/Activity
Receives Broadcast
Requests for Sources and
News Receives Broadcast
Sources and News
API GET
JSON Data
CS 442 Mobile Applications
Development (Android Section)
© Christopher Hield 2 of 9
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) and one to get
news articles from a selected news source.
1) News Sources Query Format (to be used in our assignment):
To get all sources:
https://newsapi.org/v1/sources?language=en&country=us&apiKey=_________
To get sources by category:
https://newsapi.org/v1/sources?language=en&country=us&category=______&apiKey=_______
For example, if your API Key was “ABC123xyz” and you wanted “business” news, the URL would be:
https://newsapi.org/v1/sources?language=en&country=us&category=business&apiKey= ABC123xyz
2) News Article Query Format (to be used in our assignment):
https://newsapi.org/v1/articles?source=_______&apiKey=_______
For example, if your API Key was “ABC123xyz” and you wanted “cnn” news, the URL would be:
https://newsapi.org/v1/articles?source=cnn&apiKey=ABC123xyz
CS 442 Mobile Applications
Development (Android Section)
© Christopher Hield 3 of 9
NewsAPI.org Sources Query Results Example:
https://newsapi.org/v1/sources?language=en&country=us&category=business&apiKey= ABC123xyz
The results come in the form of a JSON Array of source entries as shown below. Each entry represents an
individual news source. Example:
{
“status”: “ok”,
“sources”: [{
“id”: “al-jazeera-english”,
“name”: “Al Jazeera English”,
“description”: “News, analysis from the Middle East … broadcast schedule.”,
“url”: “http://www.aljazeera.com”,
“category”: “general”,
“language”: “en”,
“country”: “us”,
“urlsToLogos”: {
“small”: “”,
“medium”: “”,
“large”: “”
},
“sortBysAvailable”: [“top”, “latest”]
}, {

}, {
“id”: “usa-today”,
“name”: “USA Today”,
“description”: “Get the latest national, international … at USATODAY.com.”,
“url”: “http://www.usatoday.com/news”,
“category”: “general”,
“language”: “en”,
“country”: “us”,
“urlsToLogos”: {
“small”: “”,
“medium”: “”,
“large”: “”
},
“sortBysAvailable”: [“top”, “latest”]
}]
}
CS 442 Mobile Applications
Development (Android Section)
© Christopher Hield 4 of 9
NewsAPI.org Articles Query Results Example:
https://newsapi.org/v1/articles?source=cnn&apiKey=ABC123xyz
The results come in the form of a JSON Array of article entries as shown below. Each entry represents an individual
news article. Example:
{
“status”: “ok”,
“source”: “cnn”,
“sortBy”: “top”,
“articles”: [{
“author”: “Alanna Petroff”,
“title”: “United Airlines shows how to make a PR crisis a total disaster”,
“description”: “CEO Oscar Munoz is being raked … United Airlines flight.”,
“url”: “http://money.cnn.com/2017/04/11/news…/index.html”,
“urlToImage”: “http://i2.cdn.turner.com/…united-airlines-780×439.jpg”,
“publishedAt”: “2017-04-11T08:44:43Z”
}, {

}, {
“author”: “AJ Willingham, CNN”,
“title”: “Five key questions about the United controversy answered”,
“description”: “The viral incident has sparked …you need to know.”,
“url”: “http://www.cnn.com/2017/04/11/travel/questions-united-trnd/index.html”,
“urlToImage”: “http://i2.cdn.cnn.com/…with-united-00002607-super-tease.jpg”,
“publishedAt”: “2017-04-11T15:30:01Z”
}, {

}, {
“author”: “Ivana Kottasova”,
“title”: “United Airlines shares drop after man dragged off flight”,
“description”: “Shares in United Airlines dropped … overbooked flight.”,
“url”: “http://money.cnn.com/…/ passenger-flight-video/index.html”,
“urlToImage”: “http://i2.cdn.turner.com/…united-747-780×439.jpg”,
“publishedAt”: “2017-04-11T05:44:28Z”
}]
}
CS 442 Mobile Applications
Development (Android Section)
© Christopher Hield 5 of 9
Application Behavior Diagrams:
1) Overview
A News Source can be
selected by opening the
“drawer” and selecting a
source
A News category can be
selected using the options
menu
A news-related background
is shown before any articles
are loaded
The selected news source is
displayed in the Navigation Bar
News articles from the selected
source are displayed in a “view
pager” allowing left & rightswipe navigation between
articles.
Article count is maintained at
the bottom of the screen
CS 442 Mobile Applications
Development (Android Section)
© Christopher Hield 6 of 9
2) Selecting a news source:
3) Swipe Right (or Left) to scroll through articles from the selected new source: Scroll
Swipe
CS 442 Mobile Applications
Development (Android Section)
© Christopher Hield 7 of 9
4) Select a news category from the options menu to limit the news source choices to only those offering that
category of news.
5) Click on article content to go to extended article on the news source web site
CS 442 Mobile Applications
Development (Android Section)
© Christopher Hield 8 of 9
Application Content:
ViewPager
NewsService ServiceReceiver
ServiceThread
News Source Request
News Story LIst
News Source
Downloader
NewsReceiver MainActivity
category
News Article
Downloader
Source Story LIst
Source LIst NewsFragment
NewsFragment
NewsFragment
NewsFragment
NewsFragment
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.
Submissions & Grading
1) Submissions must consist of your zipped project folder (please execute Build =>Clean Project before
generating the zip file).
2) Submissions should reflect the concepts and practices we cover in class, and the requirements
specified in this document.
3) Late submissions will be penalized by 10% per week late. (i.e., from one second late to 1 week late:
10% penalty, from one week plus one second late to 2 weeks late: 20% penalty, etc.).
4) Grading will be based upon the presence and proper functionality of all features and behaviors
described in this document.
CS 442 Mobile Applications
Development (Android Section)
© Christopher Hield 9 of 9
Extra Credit
Up to 25 points of extra credit will be awarded if you implement a feature that allows the user to go to the
complete extended article on the news source’s website by clicking on the article headline, text or image.
Note: The article URL is available with every news article in the JSON data.
Up to 10 points of extra credit will be awarded if add a professional looking launcher icon to your app.
NOTE
This assignment is worth 350 points. This means (for example) that if you get 89% on this
assignment, your recorded score will be:
(88% * 350 points = 308 points)
Note that this also means that the 10% late submission penalty will be 10% * 350 points = 35 points.
If you do not understand anything in this handout, please ask.
Otherwise the assumption is that you understand the content.
Unsure? Ask!