Skip to content

Repository files navigation

Spray Navigator

A React Native Android application built for Three Rivers Mosquito Vector Control to assist field technicians during spray operations. Technicians pair the app with a Bluetooth GPS/fogger module mounted on the spray truck, and the app tracks their route in real time — recording where the sprayer was active — then uploads the data to Google Drive so the main office can review coverage.


Features

  • Live Bluetooth tracking — pairs with an HC-05 Bluetooth module on the spray truck to receive GPS coordinates, speed, elevation, and fogger on/off status in real time
  • Map display — plots the spray route as a colored polyline: red where the fogger was active, green where it was off
  • Recording — saves each session as a CSV file with timestamp, latitude, longitude, speed, elevation, and fogger state
  • Playback — replay any saved recording on the map with play/pause controls and a scrubber slider
  • Offline maps — download OpenStreetMap tiles for a defined area so the app works without cellular coverage in the field
  • Google Drive sync — sign in with Google to import or export CSV recordings between the device and Drive, giving the main office access to spray records
  • File management — view and delete saved recordings directly on the device

Screenshots

Screenshots coming soon.


Hardware

The app communicates with an HC-05 Bluetooth Classic module connected to a GPS unit and fogger sensor on the spray truck. The module transmits comma-separated data packets in the format:

<index>,<latitude>,<longitude>,<speed>,<elevation>,<fogger>

The app parses this stream, timestamps each packet with the device clock, and displays/records the data.


Tech Stack

Area Library
Framework React Native 0.75
Navigation React Navigation 6 (Native Stack)
Maps react-native-maps
Bluetooth react-native-bluetooth-classic
Database react-native-sqlite-storage
Google Auth @react-native-google-signin/google-signin
Google Drive @robinbobin/react-native-google-drive-api-wrapper
Offline tiles react-native-fs + react-native-blob-util
Network status @react-native-community/netinfo

Project Structure

src/
├── App.js                  # Root navigator, initializes Google Sign-In and local DB
├── components/
│   ├── Header.js           # Scrollable nav bar present on every screen
│   ├── MapDisplay.js       # Map with polyline rendering (online + offline tiles)
│   ├── ModeSelector.js
│   └── StatusIndicator.js
├── pages/
│   ├── HomePage.js         # Landing screen
│   ├── RecordingPage.js    # Live Bluetooth recording + map
│   ├── PlaybackPage.js     # CSV playback with play/pause slider
│   ├── DeletePage.js       # Manage saved recordings
│   ├── SetRegionPage.js    # Download offline map tiles for a region
│   └── ImportExportPage.js # Google Drive import/export
└── utils/
    ├── BluetoothService.js # HC-05 connection and data stream parsing
    ├── database.js         # SQLite helpers for in-session recording
    ├── export.js           # CSV export and native share sheet
    ├── fileUtils.js        # Local file I/O and Google Drive file operations
    ├── googleSignIn.js     # Google Sign-In configuration and helpers
    ├── screenUtils.js      # Responsive font/padding utilities
    ├── tileDownloader.js   # Downloads and caches OSM tiles
    └── tileStorage.js      # Retrieves cached tiles from local storage

Setup

Prerequisites

  • Node >= 18
  • React Native CLI environment (setup guide)
  • Android Studio with an Android SDK
  • A physical Android device or emulator (Bluetooth features require a real device)

Install dependencies

yarn install

Configure credentials

This repo uses placeholder values for all API keys. Before building, replace the following:

File Placeholder What to use
android/app/src/main/AndroidManifest.xml YOUR_GOOGLE_MAPS_API_KEY Google Maps Android API key from Google Cloud Console
android/app/google-services.json All YOUR_* values Download your own google-services.json from Firebase Console
android/oauth-client-config.json YOUR_ANDROID_CLIENT_ID, YOUR_PROJECT_ID OAuth 2.0 client credentials from Google Cloud Console
src/utils/googleSignIn.js YOUR_WEB_CLIENT_ID Web client ID from Google Cloud Console

Run on Android

# Start Metro
yarn start

# In a second terminal
yarn android

Android Permissions

Permission Purpose
ACCESS_FINE_LOCATION / ACCESS_COARSE_LOCATION GPS positioning
BLUETOOTH_CONNECT / BLUETOOTH / BLUETOOTH_ADMIN HC-05 Bluetooth pairing and communication (Android 12+ requires BLUETOOTH_CONNECT)
INTERNET Map tiles and Google Drive API
WRITE_EXTERNAL_STORAGE / READ_EXTERNAL_STORAGE Saving and reading CSV recording files

License

This project was developed for Three Rivers Mosquito Vector Control. All rights reserved.

About

SN Android

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages