A location tracking application with a mobile client and backend server.
Life Beacon 360 is a prototype location tracking system that consists of:
- Mobile Client: Android app that tracks user location and sends it to a server
- Server: Go backend that receives and stores location data
This project allows for real-time or interval-based location tracking with authorization.
-
Install dependencies:
cd mobile_client npm install
-
Build the app:
npm run build
-
Add Android platform:
npx cap add android
-
Copy the web assets to Android:
npx cap sync android
-
Open in Android Studio:
npx cap open android
-
Build and install the app on your device from Android Studio
-
Configure Settings:
- Enter the Server Address (e.g.,
http://your-server:8080/api/locations
) - Enter the Server Token (same as configured in your server's
.env
file) - Set the Location Interval (in seconds, 0 = immediate)
- Enable "Send Location to Server" if you want to send data
- Press "Save Settings"
- Enter the Server Address (e.g.,
-
Start Tracking:
- Navigate to the Tracking page
- Press "Start Tracking" to begin location tracking
- The app will request location permissions
- Position data will appear on screen
- If sending is enabled, location will be sent at the specified interval
- Press "Stop Tracking" to stop location updates
-
Background Operation:
- The app will continue tracking location even when minimized or the screen is off
- A notification will appear showing tracking is active
-
Create a
.env
file in theserver/config
directory:cp server/config/.env.example server/config/.env
-
Edit the
.env
file with your database credentials and API token:POSTGRES_USER=your_db_user POSTGRES_PASSWORD=your_db_password POSTGRES_DB=life_beacon_db POSTGRES_HOST=localhost POSTGRES_PORT=6000 API_TOKEN=your_api_token
-
Start the PostgreSQL database:
cp docker-compose-example.yml docker-compose.yml # Edit docker-compose.yml to match your credentials docker-compose up -d
-
Build and run the server:
cd server go build -o life-beacon-server ./cmd ./life-beacon-server
- URL:
/api/locations
- Method:
POST
- Auth Required: Yes (Token in Authorization header)
- Headers:
Content-Type: application/json
Authorization: Bearer YOUR_API_TOKEN
- Body:
{ "latitude": 37.7749, "longitude": -122.4194 }
- Success Response:
- Code: 201
- Content:
{ "message": "Location saved successfully" }
-
Location Not Updating:
- Ensure location permissions are granted
- Check that GPS is enabled on your device
- On Android 10+, make sure background location permission is granted
-
Failed to Send Location:
- Verify server address is correct and includes the full path
- Confirm the API token matches between client and server
- Check that the server is running and accessible
- Ensure your device has internet connectivity
-
Database Connection Issues:
- Verify PostgreSQL is running (
docker ps
) - Check the database credentials in
.env
- Ensure the port is accessible
- Verify PostgreSQL is running (
- Mobile client logs can be viewed in Android Studio's Logcat
- Server logs appear in the terminal where the server is running
This is a prototype and has basic security features:
- Token-based API authentication
- Data sent over HTTPS is recommended for production
For a production environment, consider adding:
- User authentication
- Data encryption
- More robust error handling
- Rate limiting
- TLS/HTTPS
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) - see the LICENSE file for details.
The AGPL-3.0 requires that if you modify this software and provide it as a service over a network (e.g., a web application), you must make your modified source code available to the users of that service.