An Android app that detects falls using on-device ML inference and phone sensors, then sends an SMS alert with location to a configured caretaker.
The TensorFlow Lite model bundled in app/src/main/assets/model.tflite is produced by the ML pipeline repo: Elderly-Fall-Detection. That repo also outputs deploy_config.json (input scaler stats + tuned threshold), which TFLiteRunner reads at runtime so the model and the app stay in sync across retrains.
- Google Play Store: Coming soon — link will be added once the listing goes live.
- GitHub Release: SafeMotion v1.0 — download the APK directly from the latest release.
The app runs a foreground service that continuously monitors accelerometer and gyroscope data. When a potential fall is detected, it goes through a 4-gate validation pipeline to eliminate false positives:
- Impact Gate — Peak accelerometer magnitude must exceed 25 m/s² (~2.5g)
- Free-Fall Gate — A dip below 6 m/s² must precede the impact (the brief weightlessness before hitting the ground)
- ML Gate — A TensorFlow Lite model must score the sensor window above the threshold loaded from
assets/deploy_config.json(currently 0.45) - Stillness Gate — Post-impact accelerometer data must show the person is stationary for ~2.5 seconds (rules out trips where the person recovers)
Only when all four gates pass does the app trigger an alert.
- Phone vibrates and plays an alarm sound
- A 15-second countdown gives the user time to cancel (false alarm)
- If not cancelled, an SMS is sent to the caretaker with:
- User's name and phone number
- Google Maps link to last known location
- Two monitoring modes:
- Constant — Sensors always at high rate (~50 Hz). Most reliable.
- Adaptive — Starts at low rate, switches to high rate on significant motion. Saves battery.
- Sliding window inference — Overlapping sensor windows ensure falls at window boundaries aren't missed
- 3-minute cooldown between alerts to prevent repeated firing
- Setup wizard for configuring user and caretaker details
- Test Alert button to verify SMS delivery without simulating a fall
ForegroundSensorService Main service — sensor listener, pipeline orchestrator, alert dispatch
├── SensorBuffer Sliding window of accelerometer + gyroscope samples
├── FallValidator Physics-based gates (free-fall, impact, stillness)
├── TFLiteRunner TensorFlow Lite model inference
├── WakeDetector Adaptive mode: gates LOW↔HIGH rate switching
├── MetricsLogger Tracks sensor events and inference counts
└── AppStatusNotifier Persistent status notification
- Android 8.0+ (API 26)
- Permissions: SMS, Location, Notifications, Body Sensors
./gradlew assembleDebugThe TFLite model file (model.tflite) must be placed in app/src/main/assets/.
Monitor the detection pipeline in real-time:
adb logcat -s INFERENCE:D ALERT:D ADAPTIVE:D MODE:D| Log tag | What it shows |
|---|---|
INFERENCE |
Gate decisions, confidence scores, stillness results |
ALERT |
SMS sent/failed, cooldown, cancel events |
ADAPTIVE |
Rate switching (HIGH/LOW) |
MODE |
Service start mode (ADAPTIVE or CONSTANT) |
- Kotlin
- TensorFlow Lite 2.12
- Android Foreground Service
- SensorManager (Accelerometer + Gyroscope)
- SmsManager for alert delivery
- LocationManager for GPS coordinates