Documentation

Technical documentation for the PestControlOS CRM and Android app.

Architecture, security, Firestore model, and feature details for developers and technical reviewers.

Android: In-app notifications

Technical specification for in-app notifications (no push) in the PestControlOS Android app.

Design principle

  • In-app only: No FCM push notifications; no Android status-bar notifications. All notification delivery is via in-app notification records. Ensures consistent behaviour and full application control over when and how notifications are shown.

Data model

  • Firestore: notifications/{user}/items. Each document represents one notification: type (e.g. job assigned, contract assigned, message), title/body, reference (job ID, contract ID, conversation ID), timestamp, read flag. User segment is Firebase Auth UID or app-specific user ID (e.g. 001, 002).
  • Writes: In-app notification records are written by the Android client (and optionally by Cloud Functions for server-driven events). Some function triggers that previously wrote the same records are intentionally disabled to avoid duplicates.

UI

  • Home screen shows unread indicators (badge or count) for notifications and messages. Notifications screen lists items; tap opens relevant screen (Work View, Contracts, Jobs, Messaging) and can open location (Maps) via deep-link or intent. Notifications can be deleted individually or cleared (update or delete documents in Firestore).

Reminders

  • WorkManager schedules a local task ~30 minutes before scheduled events; task writes an in-app notification document (or updates state) so the user sees it in the app. No system alarm or push.

Rules

  • Firestore rules: allow read/write on notifications/{userId}/items only when request.auth.uid matches userId (or equivalent for app user ID). Clients must not write to other users’ notification collections.