Skip to content

saivittalb/covsense

Repository files navigation

CovSense

Codacy Badge Version License PR's Welcome GitHub followers Twitter Follow

An Android based contact tracing app which enables people to self-isolate if they have been in close proximity to someone tested positive for COVID-19. The app uses a combination of Wi-Fi, Bluetooth, BluetoothLE and ultrasonic modem to communicate a unique-in-time pairing code between devices (using the Nearby Messages Google API). This technology can be scaled beyond the demo to work on iOS as well. Furthermore the solution can be embedded in other existing applications as a library to have larger adoption of the contact tracer.

Available in Dark and Light themes. Themes are pre-chosen depending on the user system settings. Preview of the app is available below in this document.

License

This project is licensed under the Apache License 2.0, a permissive license whose main conditions require preservation of copyright and license notices. Contributors provide an express grant of patent rights. Licensed works, modifications, and larger works may be distributed under different terms and without source code. Trademark use is also strictly prohibited. Any material found which vandalises or threatens any sort of plagiarism will be strictly given a legal action.

Copyright (c) 2020 Sai Vittal B. All rights reserved.

Preview

Dark theme

Light theme

Android Signed APK build (Debug)

The signed .apk debug build variant of this app that you can install on your Android device is available here in the link below.
https://firebasestorage.googleapis.com/v0/b/poised-elf-275018.appspot.com/o/app-debug.apk?alt=media&token=e59d898b-7f66-4055-9a21-48a11fef1e37

Demo

A short video demonstration of the app when the health status of one user has been modified is available here in the links below.
https://youtu.be/G6MQR8V4Wig
https://firebasestorage.googleapis.com/v0/b/poised-elf-275018.appspot.com/o/CovSense%20-%20Android%20Demo.mp4?alt=media&token=d0f71f6a-6a29-415a-8099-7e64fd5d6f40

Corner cases (known as of now)

  • Tracking does not happen when the user is on a phone call.

If you discover any failing test cases, you are encouraged to open an issue or a PR regarding it.

Working

After you sign in, you get an OTP generated using Firebase Phone Authentication. After you login, the application starts a background service that constantly publishes and receives the Firestore Database UIDs, by using the Nearby Messages API from Google. When two devices are in close proximity (approximately 4 metres to 5 metres for Bluetooth + Sonar) their meetup is registered in Firestore.

In the logged in screen, you can choose your current health status and press the button. This updates your health status in the database. Using Firestore Cloud Messages, there is a JavaScript function that triggers when this update happens and sends a push notification to the users that you have interacted with.

Components

  • Android codebase in Java
  • Firebase Authentication (authenticate requests)
  • Firestore (database)
  • Nearby Messages API (contact tracing)
  • Firebase Functions (serverless code)
Note

Developed with Android Studio version 3.6.3.

Installation

Prerequisites

Android app configuration

  • Follow the instructions for setting up your Google Maps SDK for Android.
  • Follow the instructions for interacting with the Google Nearby Messages API.
  • Update your app module build.gradle file with
    • The API_KEY for the Nearby Messages API, API_KEY = "\"YOUR_API_KEY_HERE\"".
    • The MAPS_API_KEY for the Google Maps SDK for Android, MAPS_API_KEY = "\"YOUR_MAPS_API_KEY_HERE\"".
  • Update your AndroidManifest.xml file in maps meta data with your API_KEY, value = "YOUR_MAPS_API_KEY_HERE".
  • Go to your Firebase console, setup this project, select Android app, add the package name of this app and download google-services.json.
  • Move the google-services.json file you just downloaded into your Android app module root directory.
  • Create a gradle.properties file in the project's root directory and enter the following lines.
android.useAndroidX=true
android.enableJetifier=true

Database configuration

  • In the Firebase console, open the Authentication section.
  • On the Sign-in Method page, enable the Phone Number sign-in method.
  • Follow the installation guide for Firestore.
  • Set up Firebase Functions.
  • Once you complete the Firebase Functions setup, open terminal/console window over the project directory and run following commands.
$ cd ./firestore/functions

$ yarn

$ npm install

$ cd ..
 
$ firebase deploy --only functions

JSON schema for Firebase

Two tables named users.json and users-meetings.json are pre-saved in the ./CovSense/firestore directory.

Contributing

  • Fork this project by clicking the Fork button on top right corner of this page.
  • Open terminal/console window.
  • Clone the repository by running following command in git:
$ git clone https://github.com/[YOUR-USERNAME]/covsense.git
  • Add all changes by running this command.
$ git add .
  • Or to add specific files only, run this command.
$ git add path/to/your/file
  • Commit changes by running these commands.
$ git commit -m "DESCRIBE YOUR CHANGES HERE"

$ git push origin
  • Create a Pull Request by clicking the New pull request button on your repository page.

ForTheBadge built-with-love ForTheBadge powered-by-electricity

Copyright (c) 2020 Sai Vittal B. All rights reserved.

Made with ❤ by Sai Vittal B

About

🦠 An Android based contact tracing app which enables people to self-isolate if they have been in close proximity to someone tested positive for COVID-19.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published