This repository contains the code of a Java-based mobile application University project (03/2024) and its backend Firebase Cloud Functions for a very simple real-time Civil Protection Alert System. The system enables users to report incidents like Fires, Floods, and Earthquakes, calculate their threat level, and send proximity-based alerts to users in the affected area.
SmartAlert enables:
- Incident Submission: Registered users submit high‑risk events with type, comments, auto‑captured location, timestamp, and photo.
- Danger Scoring: A Firebase Cloud Function computes a "danger score" grouping nearby incidents within a time window.
- Automated Alerts: Once scored as
alert, another Cloud Function notifies users within a configurable radius via FCM. - Multilingual UI: Supports Greek and English.
- Statistics: Users can view how many incidents are on
alertstatus. - Authentication: Firebase Authentication for login.
Watch two demo videos
submitincident.mov |
admin.mp4 |
- Register/Login: Sign in with email & password.
- Submit Incident: Choose type (Fire, Flood, or Earthquake), add comments & upload photo. Your location is automatically captured.
- Await Processing:
- Backend calculates danger score; incident status progresses from
pending→scored - Admin users review scored incidents and can approve (change to
alert) or reject them
- Backend calculates danger score; incident status progresses from
- Receive Alerts: If you're within the configured radius of an approved incident (1500m for Fire, 1000m for Flood, 3000m for Earthquake), you'll receive a push notification.
- View Statistics: Open the "Statistics" screen to see counts of alerts by incident type.
The functions/index.js contains two main triggers:
-
calculateDangerScoreRuns when a new incident is added, groups incidents by proximity & time, computesdanger_score. -
sendAlertsFires when an incident's status changes toalert, sends FCM notifications to nearby users based on their location data to warn them of potential danger in their vicinity.



