Covid 19 Info Android App

  1. Introduction
    1. Course Expectations & Difficulties
    2. App Outline and Features
    3. App Demo Video
  2. App Details
    1. Design and Planning
    2. App Architecture
    3. App Component Details
  3. Future Work

Introduction

This was for the capstone project of the Coursera certificate and specialization Android App Development which had 5 courses:

  • Java for Android
  • Android App Components - Intents, Activities, and Broadcast Receivers
  • Android App Components - Services, Local IPC, and Content Providers
  • Engineering Maintainable Android Apps
  • and the Capstone project.

Here’s a link to my GitHub repo

To summarize, I created an Android app that shows the user the day’s Covid-19 data, such as total cases, today’s new cases, etc, for a country or the world. The user can search for a country to add to the main screen, remove a country, and click on a country’s info card to get more specified information. It uses an webservice api, disease.sh, which aggregates data from various sources such as Johns Hopkins University.

 

Course Expectations & Difficulties

The capstone required several components covered in its specialization:

Please note, that this course and certificate was originally created over 4 years ago and, from what I have seen, hasn’t been editted or handled by any of its professors for over 3 years. This means many new practices and standards, such as Jetpack, weren’t common/known.

In addition, this meant I had no help through the professors/TAs and there was no help from my peers. I learned the majority of the actual coding/library usage from other online free tutorials such as vogella and coding in flow.

 

App Outline and Features

Requirement My Project
An activity
- At least 2 UI screens, as activites and/or fragments
Currently the app has 3 screens:
- the main listing all tagged countries
- the search screen
- and a detailed country information screen
A service and a broadcast receiver The user can set a notification reminder to open the app.
This uses a broadcast event to open the app,
and a service to create the alarm manager/notification
Interaction with a webservice API through HTTP networking I used the 3rd pary library Retrofit2 to handle the GET requests.
It doesn’t allow POST to edit data.
An SQLite database that is accessed through a content provider To keep up with modern practices, I used the Room library.
I still created a content provider that an outside app could access, however.

As well, I followed the MVVM pattern AKA the Model - View - Viewmodel pattern. I also used a repository class to abstract the data retrival from the SQLite database and retrofit.

App Demo

 

App Details

Design and Planning:

App Architecture: MVVM and Other Classes:

During the desing and planning stage, I initially had the search activity as a simple text input, which would then be parsed to retreive the country data. It would also include basic error checks. While creating it, I discovered live lists for searches, which is more appealing UI wise.

I also changed other design aspects such the spacing between lines and added colour.

Also note that I didn’t include the Alarm buttons in the wireframe, as at the time I didn’t plan on having them to fulfill the service/receiver requirements.

I encountered lag and other issues once it came to including province/state search data. The problem is that provinces/states can only be pulled from the /all GET request, thus every country, state, and province get downloaded which is very slow. While I do have a refresh timer to limit total downloads and a SQLites database to retrive offline, it doesn’t change the lag when the GET is done.

As a result, for the search I hard-coded in the names of all countries for the search - I had initally planned to also show total or today’s cases, but the lag prevented it.

As well, I could not figure out how to combine the live search update list with the MVVM pattern - specifically the viewmodel and ListAdaptor classes. As a result, I would try to use the wireframe ver. of the search activity to incorporate province data.

Click to see my initial wireframes for the app UI

wireframe

 

Below is a diagram showing the relationship between my core classes (i.e. I did not include layout files, gradle, manifest, etc).

The base is a UML chart layout, but I added other relationships to explain the Model View Viewmodel (MVVM) pattern and highlight any UI elements such as the Notification classes and the Activity classes.

As is explained in Android Jetpack, the main idea of the MVVM pattern is to abstract the tasks of retreiving, using and showing data. Each class should only do one task - View should only deal with UI, ViewModel retrieves data and sends UI inputs, Model actually holds the data.

I also used a repository class to further abstract the data retrival process - since I have both a webservice and a database to retrieve data, the repository class handles which Model to get data for the ViewModel classes.

I also have a Content Provider as part of the requirements, which pulls from the repository class (and of the Room Model).

I used the UML Generator plugin from the IntelliJ Idea IDE to get the base of the UML charts. I then created the diagram in Paint.

Click to see a UML Chart for the classes

img

App Components:

Click to see a summary, more details are in the repo linked before

Webservice API: Link to API. Link to GitHub. The webservice API is disease.sh’s Covid19 specific API. It provides an HTTP protocol and provides a json output; no authentication key is required. They use a variety of sources, including Worldometer, John Hopkins University, and several countries’ own government provided data. There are also other data, such as vaccine news, but they are not of interest for this project.

I used Retrofit2 to handle retreving and parsing the gson data.

Activities/UI Screen: The main activity will show a list of info cards that each show a country’s data for the day (ex. total and new cases). The world’s data is also shown by default. The user can delete a card by swiping or add one via search. The cards can be clicked and lead to the 3rd activity to show more options/details.

The second activity is the search. As you type, it updates the list of options live to find a specific country or the world. Once you click a card, it will close the activity back to the main, and you will see the new country added.

The last (3rd) activity will show the details of a specific country the user clicked in the main screen. Currentlythe only extra details are the number of tests taken and the country’s population.

Notification Alarm:

In the main menu, with a time picker, the user can set a time for the notification to appear. Clicking on the notification will open the app, even if it is not active, background or foreground. This is based on the alarm manager set up with a service, broadcast receiver, and an application class to set up the notification manager. While IntentService was taught, it has been depreciated and I thus used JobIntentService. I also used a regular broadcast receiver, as opposed to a local broadcast receiver, since the notification would be used when the app is shut down to start and open it.

SQLite Database:

As mentioned before, rather than use the content provider I opted for Room. In fact, I connected the content provider to pull through the repository and Room database to use the same SQLite tables.

 

Future Work

What I cold do was limited by both my skills and my time. If I were to go back to this project, I would like to learn how to use Hilt, rxJava, and the various other graphical libraries to add more data and analysis. I would also try to improve my search activity to pull from Room, and add various other GET calls in order to get both historical data for data analysis and provincial data.

Notes

This page to be incomplete, but sufficient. More details and edits to be added in time.