Share your live location with friends in real-time, across Android and the Web!
A self-hosted, privacy-focused live location sharing application built with Flutter. Share your location with friends and family in real-time while maintaining complete control over your data through your own WebSocket server.
- Real-time Location Sharing: See your friends' current location on an interactive map
- Cross-Platform: Works on Android devices and web browsers
- Self-Hosted Backend: Complete data privacy with your own WebSocket server
- Manual & Auto Sharing: Choose between battery-friendly manual updates or automatic location sharing
- User Management: See who's online, view user lists, and manage connections
- Dark/Light Theme: Customizable appearance with theme switching
- Smart Battery Management: Optional auto-updates with configurable intervals
- Connection Status: Real-time connection monitoring with visual indicators
- User Presence: Automatic user tracking and disconnect notifications
- Map Controls: Focus on specific users, show all users, or center on your location
- Settings Management: Persistent configuration for server URLs, usernames, and preferences
- Permission Handling: Graceful location permission requests with user guidance
Map View | Settings | User List |
---|---|---|
![]() |
![]() |
![]() |
Interactive map with live locations | Server configuration & preferences | Connected users management |
The application consists of three main components:
- Flutter Client App: Cross-platform mobile and web application
- WebSocket Server: Real-time communication backend (MyTracksLoc/mytracks-ws-server)
- Google Maps Integration: Interactive mapping for location visualization
User Location β Flutter App β WebSocket Server β Other Connected Users
- WebSocket Server: Deploy the MyTracksLoc/mytracks-ws-server backend
- Flutter Development Environment:
- Flutter SDK 3.9.0 or higher
- Dart SDK
- Android Studio (for Android development)
- Google Maps API Key: Required for map functionality
- Web Server: For hosting the web version (optional)
-
Clone the repository:
git clone https://github.com/MyTracksLoc/live-location-share.git cd live-location-share
-
Install dependencies:
flutter pub get
-
Configure Google Maps API:
- Android: Add your API key to
android/app/src/main/AndroidManifest.xml
- Web: Update
web/index.html
with your API key
- Android: Add your API key to
-
Deploy the WebSocket server:
# Follow instructions at https://github.com/MyTracksLoc/mytracks-ws-server
-
Run the application:
# For Android flutter run # For Web flutter run -d web-server --web-port 8080
-
WebSocket Server URL: Configure in the app settings
- Format:
ws://your-server:port
orwss://your-server:port
- Example:
ws://localhost:8083
orwss://api.yourdomain.com
- Format:
-
User Configuration:
- Set your display name (2-20 characters)
- Choose between manual or automatic location sharing
- Select theme preference (dark/light)
- Get API Key: Visit Google Cloud Console
- Enable APIs: Enable Maps JavaScript API and Maps SDK for Android
- Configure Restrictions: Set up API key restrictions for security
- Grant Permissions: Allow location access when prompted
- Configure Server: Enter your WebSocket server URL in settings
- Set Display Name: Choose how you want to appear to other users
- Choose Sharing Mode: Select manual or automatic location updates
- Manual Sharing: Tap the send button (π€) to share your current location
- Automatic Sharing: Enable auto-updates in settings for continuous sharing
- View Others: See connected users on the map with real-time updates
- User List: Tap the users counter to see all connected users
- Focus on User: Tap a user in the list to center the map on their location
- Show All Users: Use "Show All" to fit all users in the map view
- Connection Status: Monitor connection health with the WiFi indicator
lib/
βββ main.dart # App entry point with theme management
βββ location_sharing_screen.dart # Main map and sharing interface
βββ settings_screen.dart # Configuration and preferences
βββ user.dart # User data model
web/
βββ index.html # Web app entry point
βββ manifest.json # PWA configuration
android/ # Android-specific configuration
ios/ # iOS-specific configuration
- google_maps_flutter: Interactive maps
- geolocator: Location services
- web_socket_channel: Real-time communication
- permission_handler: Location permissions
- shared_preferences: Settings persistence
- uuid: Unique user identification
Android APK:
flutter build apk --release
Web App:
flutter build web --release
iOS App:
flutter build ios --release
- WebSocket Server URL: Real-time communication endpoint
- Display Name: User identification (2-20 characters)
- Theme Mode: Dark or light appearance
- Auto Location Updates: Battery vs. real-time trade-off
- Location Update Interval: 5-second intervals for auto mode
The WebSocket server supports:
- Maximum Users: 100 concurrent connections
- Update Intervals: Minimum 2-second intervals
- User Timeout: 30-second stale data cleanup
- Rate Limiting: Protection against spam
- Self-Hosted: Your data never leaves your server
- No Third-Party Tracking: No analytics or data collection
- Local Storage: Settings stored locally on device
- Encrypted Communication: WSS support for secure connections
- Input Validation: All user inputs are validated
- Rate Limiting: Server-side protection against abuse
- User Limits: Configurable maximum concurrent users
- Stale Data Cleanup: Automatic removal of inactive users
version: '3.8'
services:
location-sharing-backend:
image: mytracks-ws-server
ports:
- "8083:8083"
environment:
- NODE_ENV=production
location-sharing-frontend:
build: .
ports:
- "80:80"
depends_on:
- location-sharing-backend
Deploy the built web files to any static hosting service:
- GitHub Pages
- Netlify
- Vercel
- Traditional web servers
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes and test thoroughly
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
- Follow Flutter/Dart best practices
- Add tests for new features
- Update documentation as needed
- Ensure cross-platform compatibility
- Group Management: Create and manage location sharing groups
- Location History: View past location data
- Offline Support: Cache locations when disconnected
- Push Notifications: Real-time alerts for location updates
- Custom Markers: Personalized user markers
- Location Sharing Links: Share locations via URL
- Web version requires HTTPS for location access
- iOS version needs additional configuration for location permissions
- Battery optimization may affect background location updates
Location not updating:
- Check location permissions
- Verify GPS is enabled
- Ensure server connection is active
WebSocket connection failed:
- Verify server URL format (ws:// or wss://)
- Check server is running and accessible
- Ensure firewall allows WebSocket connections
Maps not loading:
- Verify Google Maps API key is correct
- Check API key restrictions
- Ensure billing is enabled for Google Cloud project
This project is licensed under the MIT License - see the LICENSE file for details.
- MyTracksLoc/mytracks-ws-server - WebSocket backend server
- uWebSockets.js - High-performance WebSocket library
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Check the Wiki for detailed guides
Made with β€οΈ for privacy-focused location sharing