Android application showing Covid-19 stats in Vietnam for my study in Internet of Things Application Development course (CO3037) at Ho Chi Minh university of Technology.
The project consists of 3 components: Gateway, Server and Android application, implemented separately and connected using MQTT protocol. The project's code skeleton was implemented by my tutor in the course, Dr. Le Trong Nhan (GitHub: nhanksd).
- Use Python for implementation.
- Import
Adafruit IO
library for connecting and subscribing to Adafruit IO server with MQTT protocol. - Establish serial connection to gateway with com0com and hercules application.
- Import
requests
library for fetching JSON API to get Covid-19 stats and then publish to Adafruit IO server. - Process data transmitted by hercules in format
!MODE:0##
for mode 0 (reading cases data) and!MODE:1##
for mode 1 (reading vaccination data). - (Optional) Work with ThingsBoard server using PAHO MQTT.
- Use Adafruit IO online server.
- Use provided dashboard and feed on Adafruit for displaying data received from gateway using MQTT protocol.
- Create 2 dashboards corresponding to each mode.
- Create 4 feeds, each will get data of Confirmed case, death, people full vaccinated and partially vaccinated, and an additional feed for the mode.
- Receive data published previously on Adafruit IO server by the Gateway.
- Switch button used to display current mode.
- If current mode is 0, change the content of 2
TextView
to Confirmed cases and Death and display data received from server. - Otherwise, change the content of 2
TextView
to Fully vaccinated and Partially vaccinated. - Layout can be found at
app\src\main\res
. - Java source for main activity and MQTT protocol can be found at
app\src\main\java\vn\iot\dashboard
. - Fill in the
username
,feed-id
andAdafruit api key
in the Java source to start working with Android application.