- Add timezone as direct dependency (per lint rules) - Update initialization to set all permissions to false - Add separate macOS initialization settings - Implement platform-specific permission requests for iOS and macOS - Follow recommended pattern from flutter_local_notifications docs Co-authored-by: dz0ny <239513+dz0ny@users.noreply.github.com>
MeshCore SAR
A Flutter-based Search and Rescue (SAR) application that communicates with MeshCore mesh network devices via Bluetooth Low Energy (BLE).
Features
- Real-time Messaging: Receive and display messages from MeshCore mesh network
- Contact Management: Track team members, repeaters, and communication channels
- SAR Markers: Special location markers for found persons, fires, and staging areas
- Interactive Map: View team locations and SAR markers on an interactive map with multiple layer options:
- OpenStreetMap (default)
- OpenTopoMap (topographic)
- ESRI World Imagery (satellite)
- Offline Support: Map tiles cached for offline operation
- Telemetry Tracking: Monitor battery levels, GPS locations, and temperature for all contacts
- BLE Communication: Direct connection to MeshCore devices via Bluetooth
Prerequisites
Before building the app, ensure you have:
- Flutter SDK 3.19.0 or higher
- Dart SDK 3.3.0 or higher
- Xcode 15+ (for iOS builds)
- Android Studio with Android SDK (for Android builds)
- CocoaPods (for iOS dependencies)
Install Flutter
If you haven't installed Flutter yet:
# macOS/Linux
git clone https://github.com/flutter/flutter.git -b stable
export PATH="$PATH:`pwd`/flutter/bin"
# Verify installation
flutter doctor
Setup
-
Clone the repository:
cd /path/to/meshcore-sar/meshcore_sar_app -
Install dependencies:
flutter pub get -
Verify setup:
flutter doctorFix any issues reported by Flutter Doctor before proceeding.
Building and Running
iOS
Requirements
- macOS computer
- Xcode 15 or higher
- Apple Developer account (for physical device deployment)
- iOS device with iOS 13.0 or higher
Steps
-
Open iOS folder in Xcode:
open ios/Runner.xcworkspace -
Configure signing:
- In Xcode, select the Runner project
- Go to "Signing & Capabilities"
- Select your development team
- Xcode will automatically handle provisioning
-
Connect your iOS device via USB
-
Enable Developer Mode on your iOS device:
- Settings → Privacy & Security → Developer Mode → Enable
-
Trust your Mac on the iOS device when prompted
-
Run the app:
# Run in debug mode flutter run # Or build release flutter build ios --release -
Install on device from Xcode:
- Select your device in Xcode
- Click the "Run" button (▶️)
Common iOS Issues
Problem: "Runner has conflicting provisioning settings"
# Solution: Clean and rebuild
cd ios
pod deintegrate
pod install
cd ..
flutter clean
flutter pub get
Problem: Bluetooth permissions not working
- Ensure
Info.plistcontains all required permission keys - Check that permissions are requested at runtime
Android
Requirements
- Android Studio installed
- Android SDK 21 (Android 5.0) or higher
- Physical Android device or emulator
Steps
-
Enable Developer Options on your Android device:
- Settings → About Phone → Tap "Build Number" 7 times
- Go back → Developer Options → Enable "USB Debugging"
-
Connect your Android device via USB and authorize the computer
-
Verify device connection:
flutter devices -
Run the app:
# Run in debug mode flutter run # Or specify device flutter run -d <device-id> -
Build APK:
# Debug APK flutter build apk --debug # Release APK flutter build apk --release # App Bundle (for Play Store) flutter build appbundle --releaseThe APK will be located at:
- Debug:
build/app/outputs/flutter-apk/app-debug.apk - Release:
build/app/outputs/flutter-apk/app-release.apk
- Debug:
-
Install APK manually:
# Install on connected device flutter install # Or use adb adb install build/app/outputs/flutter-apk/app-release.apk
Common Android Issues
Problem: Gradle build fails
# Solution: Clean and rebuild
flutter clean
cd android
./gradlew clean
cd ..
flutter pub get
flutter build apk
Problem: Bluetooth permissions denied
- Ensure all Bluetooth permissions are in
AndroidManifest.xml - For Android 12+, request
BLUETOOTH_SCANandBLUETOOTH_CONNECTat runtime
Problem: "Execution failed for task ':app:minifyReleaseWithR8'"
# Add to android/app/build.gradle
android {
buildTypes {
release {
minifyEnabled false
}
}
}
Running on Emulator/Simulator
iOS Simulator
# List available simulators
flutter emulators
# Launch a simulator
flutter emulators --launch <simulator-id>
# Run app
flutter run
Note: BLE functionality will not work on iOS Simulator. Use a physical device for testing.
Android Emulator
# List available emulators
flutter emulators
# Create new emulator in Android Studio:
# Tools → Device Manager → Create Virtual Device
# Launch emulator
flutter emulators --launch <emulator-id>
# Run app
flutter run
Note: BLE functionality requires specific emulator setup or physical device.
Permissions
The app requires the following permissions:
iOS (ios/Runner/Info.plist)
NSBluetoothAlwaysUsageDescription: Bluetooth access for MeshCore devicesNSLocationWhenInUseUsageDescription: Location access for map features
Android (android/app/src/main/AndroidManifest.xml)
BLUETOOTH_SCAN: Scan for BLE devicesBLUETOOTH_CONNECT: Connect to BLE devicesACCESS_FINE_LOCATION: Required for BLE scanningINTERNET: Download map tiles
Usage
-
Connect to MeshCore Device:
- Tap "Connect" in the status bar
- Select your MeshCore device from the scan results
- Wait for connection confirmation
-
View Messages:
- Messages tab shows all received messages
- SAR marker messages are highlighted
- Tap SAR marker to view on map
-
Manage Contacts:
- Contacts tab shows team members, repeaters, and channels
- Tap contact to view details
- Use refresh button to request telemetry updates
-
View Map:
- Map tab displays team locations and SAR markers
- Tap layer selector to switch between map styles
- Use zoom controls or pinch gestures
- Tap markers for details
- Tap items in bottom list to navigate
SAR Marker Format
Messages can contain SAR markers using this format:
S:<emoji>:<latitude>,<longitude>
Examples:
S:🧑:46.0569,14.5058- Found personS:🔥:46.0570,14.5060- Fire locationS:🏕️:46.0571,14.5062- Staging area
Architecture
- Models: Data structures for contacts, messages, markers, telemetry
- Services: BLE communication, tile caching, protocol parsing
- Providers: State management using Provider pattern
- Screens: UI components for messages, contacts, map
- Widgets: Reusable UI elements like map markers
Dependencies
Key packages used:
flutter_blue_plus: BLE communicationflutter_map: Interactive mappingflutter_map_tile_caching: Offline map tilesprovider: State managementlatlong2: GPS coordinate handlingpermission_handler: Runtime permissions
Troubleshooting
App crashes on launch
flutter clean
flutter pub get
flutter run
BLE not working
- Ensure Bluetooth is enabled on device
- Check that all permissions are granted
- Verify MeshCore device is powered on and in range
Map tiles not loading
- Check internet connection
- Verify tile URLs are accessible
- Clear tile cache and reload
Build errors
# Complete clean rebuild
flutter clean
cd ios && pod deintegrate && pod install && cd ..
cd android && ./gradlew clean && cd ..
flutter pub get
flutter run
License
This project is for Search and Rescue operations using MeshCore mesh network devices.
Support
For issues related to:
- Flutter: https://flutter.dev/community
- MeshCore Protocol: https://github.com/meshcore-dev/meshcore.js
- App Issues: Open an issue in this repository