A Flutter application for hiking and outdoor adventures that enables offline location tracking, communication, and emergency alerts through Peer-to-Peer networking.
Designed with an Offline-First architecture, TrailGuide establishes direct Peer-to-Peer (P2P) connections between nearby devices without requiring an internet connection or centralized server, making it ideal for remote and low-signal environments.
TrailGuide is a Flutter-based mobile application designed to improve safety and communication during hiking trips and outdoor activities where internet connectivity is unavailable.
The application leverages the Android Nearby Connections API over Bluetooth and Wi-Fi Direct to establish an offline Peer-to-Peer network, enabling real-time sharing of GPS locations, compass directions, and emergency messages among group members.
Trip history, routes, and statistics are stored locally using Isar Database, allowing the application to operate entirely offline while ensuring user privacy.
- ๐ก Offline Peer-to-Peer Communication
- ๐งญ Real-time GPS Tracking & Smart Radar
- ๐จ Emergency SOS Broadcasting
โ ๏ธ Automatic Proximity Alerts- ๐บ๏ธ Offline Trip History Logging
- ๐พ Local Storage with Isar Database
- ๐๏ธ Clean Architecture with BLoC Pattern
Displays GPS status, provides quick flashlight access, and introduces the application's core features.
Once users join the same room, TrailGuide displays each member's position in real time by combining GPS coordinates with compass heading to calculate distance and direction.
TrailGuide continuously monitors the distance between group members. When someone moves beyond the predefined safety range, an automatic proximity alert is triggered.
In emergency situations, users can broadcast an SOS signal that immediately notifies every connected device with both visual and vibration alerts.
At the end of each trip, TrailGuide automatically records travel statisticsโincluding duration, total distance, route information, and participant detailsโinto the local database for future reference.
| Feature | Description |
|---|---|
| ๐ก Offline P2P Communication | Direct device-to-device communication via Bluetooth and Wi-Fi Direct without internet access |
| ๐งญ Smart Radar | Real-time radar visualization using GPS coordinates and compass heading |
| Automatically warns users when teammates move beyond the safe distance threshold | |
| ๐จ SOS Broadcast | Instantly broadcasts emergency alerts to every connected group member |
| ๐ Keep-Alive Monitoring | Continuously monitors peer connectivity using a Ping/Pong mechanism |
| ๐บ๏ธ Trip History | Automatically records hiking statistics and routes using Isar Database |
| ๐ท Profile Image Sync | Compresses and transfers profile images efficiently over the P2P network |
| Category | Technology |
|---|---|
| Language | Dart, Kotlin (Native Bridge) |
| Framework | Flutter |
| Architecture | Clean Architecture |
| State Management | BLoC, Cubit |
| Database | Isar |
| GPS | Geolocator |
| Compass | Flutter Compass |
| Flashlight | Torch Light |
| Routing | GoRouter |
| P2P Communication | Android Nearby Connections API |
| Native Integration | MethodChannel & EventChannel |
TrailGuide follows Clean Architecture, clearly separating the Presentation, Domain, and Data layers. Native Android functionality is exposed to Flutter through platform channels, allowing direct access to the Nearby Connections API.
Flutter UI
โ
โผ
BLoC / Cubit
โ
โผ
Domain Use Cases
โโโโโโโโโโโโดโโโโโโโโโโโ
โผ โผ
P2P Repository History Repository
โ โ
โผ โผ
Nearby Data Source Isar Data Source
โ
โผ
Android Nearby API
(MethodChannel / EventChannel)
lib
โ
โโโ core
โ โโโ config
โ โโโ constants
โ โโโ error
โ โโโ theme
โ โโโ utils
โ
โโโ features
โ โโโ history
โ โโโ onboarding
โ โโโ p2p
โ โโโ profile
โ โโโ settings
โ โโโ tracking
โ
โโโ main.dart
| Folder | Responsibility |
|---|---|
| core | Shared utilities, application configuration, themes, and common components |
| history | Trip history management using Isar |
| onboarding | User profile setup and onboarding flow |
| p2p | Peer-to-Peer communication and room management |
| profile | User profile features |
| settings | Application settings |
| tracking | GPS tracking and location calculations |
๐ฑ Device A (Host) ๐ฑ Device B (Member)
โ โ
๐ก Start Advertising ๐ก Start Discovery
โ โ
โโโโโโโโโ ๐ค Handshake & PIN โโโโโโโโโค
โ โ
๐ Send GPS (LOC:HOST,Lat,Lng) โโโโโโถ ๐ Receive GPS Data
โ โ
๐งฎ LocationCalculator ๐งฎ LocationCalculator
(Distance & Bearing) (Distance & Bearing)
โ โ
๐งญ Merge Compass + GPS ๐งญ Merge Compass + GPS
โ โ
๐ฏ Update Radar UI ๐ฏ Update Radar UI
| Challenge | Solution | Result |
|---|---|---|
| Unexpected P2P disconnections | Keep-Alive (Ping/Pong) mechanism | Automatically detects disconnected peers |
| Compass instability and sensor noise | Low-pass filtering | Smoother and more accurate radar rotation |
| Flutter-to-Android communication | EventChannel streaming | Real-time bidirectional data transfer |
| Large profile image size | Image compression + Base64 encoding | Faster P2P transmission with reduced bandwidth usage |
| Continuous GPS tracking | Stream processing with Isar | Efficient route recording and local persistence |
git clone https://github.com/MarkCnw/TrailGuide.git
cd TrailGuide
flutter pub get
flutter run




