Skip to content

dandinu/Bloodhound

 
 

Repository files navigation

Bloodhound Bloodhound

Take control of your device without any of the privacy issues.

Bloodhound is a free and open-source device tracker for Android designed for authorized device recovery and monitoring. Track your own devices for legitimate anti-theft purposes with complete privacy control.

Bloodhound Dashboard

⚠️ Important Security Notice

This application is intended ONLY for:

  • Tracking your own devices for anti-theft purposes
  • Authorized security testing and research
  • Educational purposes with proper consent

Unauthorized use of tracking software may be illegal in your jurisdiction.

Features

  • 📍 GPS Location Tracking - Real-time location updates
  • 📷 Remote Camera Capture - Take photos from front/back cameras
  • 🎤 Audio Recording - Remote microphone access
  • 🔔 Remote Alarm - Trigger alarm even on silent mode
  • 📱 SMS Trigger - Activate via text message
  • ☁️ Nextcloud Integration - Store data on your private cloud
  • 🚨 Emergency SMS - Send tracking data via SMS
  • 🔒 Privacy First - No third-party servers, you control everything

Requirements

Development Environment

  • Android Studio (latest version recommended)
  • JDK 17 or newer (JDK 22 recommended)
  • Android SDK API 34 (automatically downloaded via Gradle)
  • Gradle 8.8+ (included via wrapper)

Device Requirements

  • Minimum Android Version: Android 7.0 (API 24)
  • Target Android Version: Android 14 (API 34)
  • Required permissions: Location, Camera, Microphone, SMS, Storage

Building the App

Quick Start

  1. Clone the repository

    git clone <repo_url>
    cd Bloodhound
  2. Set up environment (macOS/Linux)

    export ANDROID_HOME=$HOME/Library/Android/sdk
    export PATH=$PATH:$ANDROID_HOME/emulator
    export PATH=$PATH:$ANDROID_HOME/platform-tools
  3. Build the app

    ./gradlew assembleDebug
  4. Install on device/emulator

    ./gradlew installDebug

Build Commands

# Clean build
./gradlew clean

# Build debug APK
./gradlew assembleDebug

# Build release APK
./gradlew assembleRelease

# Run tests
./gradlew test

# Install to connected device
./gradlew installDebug

# Run lint checks
./gradlew lint

Running in an Emulator

  1. List available emulators

    emulator -list-avds
  2. Start an emulator

    # Replace <avd_name> with your emulator name from the list above
    emulator -avd <avd_name>
    
    # Example:
    emulator -avd Pixel_7
  3. Wait for the emulator to fully boot, then install the app

    # Build and install in one command
    ./gradlew installDebug
    
    # Or install a pre-built APK manually
    adb install -r app/build/outputs/apk/debug/app-debug.apk
  4. Launch the app

    adb shell am start -n me.dbarnett.bloodhound/.BloodhoundActivity

Tip: You can run the emulator in the background by appending & to the command:

emulator -avd Pixel_7 &

Testing Location Capture on Emulator

Location updates are configured with a 5-minute interval and 20-meter minimum movement. On an emulator sitting still, no locations will be captured automatically. Use mock locations to test:

# Send mock location to emulator while tracking is active
adb emu geo fix -122.4194 37.7749

# Or with different coordinates to trigger a location change
adb emu geo fix -122.4200 37.7755

Test steps:

  1. Start tracking (tap FAB button)
  2. Run the geo fix command above
  3. Wait a moment, then check Capture Browser
  4. Location files should appear in /files/Location/

Nextcloud Setup (Optional)

To use Nextcloud integration for remote control and data storage:

  1. Create Bloodhound directory in your Nextcloud root:

    Nextcloud/
      └── Bloodhound/
          ├── Config/
          │   ├── check          # Binary flag (0 or 1)
          │   └── config.json    # Feature configuration
          ├── Pictures/          # Uploaded photos
          ├── Location/          # Location JSON files
          └── Recordings/        # Audio recordings
    
  2. Configure tracking in config.json:

    {
      "location": "true",
      "camera": "false",
      "alarm": "false",
      "mic": "false"
    }
  3. Enable/disable tracking via the check file:

    • 1 = tracking enabled
    • 0 = tracking disabled

Architecture

Bloodhound uses a service-based architecture:

  • BloodhoundService - Core tracking service (location, camera, mic, alarm)
  • CheckService - Polls Nextcloud every 60 seconds for remote commands
  • SmsReceiver - Listens for SMS trigger messages
  • BootReceiver - Auto-starts services on device boot

Data is uploaded to your Nextcloud server or sent via SMS based on configuration.

Using the App

First-Time Setup

  1. Grant Permissions - On first launch, approve all requested permissions:

    • Location (Fine & Coarse)
    • Camera
    • Microphone
    • SMS (Send, Receive, Read)
    • System Alert Window
    • Battery Optimization Exclusion
  2. Configure Nextcloud (Optional)

    • Tap the menu (three dots) → "Nextcloud Login"
    • Enter your Nextcloud server URL, username, and password
    • The app will create required directories automatically
  3. Set Emergency Contact

    • Tap the menu → "Settings"
    • Enter a phone number for emergency SMS tracking notifications

Triggering Camera Tracking

There are three ways to activate camera tracking:

Method 1: Manual Activation (Long-Press)

  1. Long-press the paw logo on the main screen (hold for 2 seconds)
  2. Select "Start Full Tracking" from the menu
  3. Camera will begin capturing photos immediately (back camera → front camera → 60s delay → repeat)

Method 2: SMS Trigger

  1. Configure trigger phrase in Settings
  2. Send SMS with trigger phrase to the device
  3. Camera tracking starts automatically

Method 3: Nextcloud Remote Control

  1. Set up Nextcloud integration
  2. Update Bloodhound/Config/check file to 1
  3. Configure features in config.json
  4. CheckService polls server every 60 seconds and starts tracking when enabled

Verifying Camera Is Working

Check via ADB Logs

# Monitor camera activity in real-time
adb logcat | grep -E "CameraX|BloodhoundService|ImageCapture"

# You should see logs like:
# D/CameraXCaptureManager: Starting capture sequence
# D/CameraXCaptureManager: Capturing photo with BACK camera
# D/CameraXCaptureManager: Photo saved successfully: /data/data/.../Pictures/IMG_20250126_143052.jpg

Check Captured Files

# List captured photos
adb shell "run-as me.dbarnett.bloodhound ls -la /data/data/me.dbarnett.bloodhound/files/Pictures/"

# Expected output:
# -rw------- 1 u0_a123 u0_a123 245678 2025-01-26 14:30 IMG_20250126_143052.jpg
# -rw------- 1 u0_a123 u0_a123 198234 2025-01-26 14:30 IMG_20250126_143053.jpg

Check Service Status

# Verify BloodhoundService is running
adb shell dumpsys activity services me.dbarnett.bloodhound

# Look for:
# ServiceRecord{...BloodhoundService...}
#   app=ProcessRecord{...} (should NOT be null)

Troubleshooting

Camera Not Capturing Photos

Problem: No photos in Pictures directory after triggering tracking

Solutions:

  1. Check service is actually running:

    adb shell dumpsys activity services me.dbarnett.bloodhound | grep "app="

    If app=null, the service didn't start. Check if:

    • Emergency phone number is configured in Settings
    • All camera permissions are granted
    • Battery optimization is disabled for Bloodhound
  2. Check for camera initialization errors:

    adb logcat | grep -E "CameraX|Camera.*error"
  3. Verify storage directory exists:

    adb shell "run-as me.dbarnett.bloodhound mkdir -p /data/data/me.dbarnett.bloodhound/files/Pictures"
  4. Restart the app completely:

    • Force stop app
    • Clear app data if necessary
    • Re-grant all permissions
    • Try triggering again

Service Stops Immediately

Problem: Service starts but stops after a few seconds

Cause: Android's background service restrictions on newer versions

Solutions:

  • Disable battery optimization for Bloodhound
  • Consider using "Start Foreground Tracking" instead (shows persistent notification)
  • Check for crashes in logcat: adb logcat | grep AndroidRuntime

Photos Not Uploading to Nextcloud

Problem: Photos are captured locally but not appearing on Nextcloud

Solutions:

  1. Verify Nextcloud credentials in Settings
  2. Check network connectivity
  3. Ensure Bloodhound/Pictures/ directory exists on Nextcloud server
  4. Check upload logs: adb logcat | grep -E "Nextcloud|Upload"

Data Storage

All data is stored locally in app-specific storage before being uploaded to Nextcloud. Files are stored in:

Local Device Storage

Base path: /data/data/me.dbarnett.bloodhound/files/

Type Directory File Format Example
Camera Photos Pictures/ IMG_yyyyMMdd_HHmmss.jpg IMG_20250126_143052.jpg
Location Data Location/ yyyyMMdd_HHmmss.json 20250126_143052.json
Audio Recordings Recordings/ yyyyMMdd_HHmmss.mp3 20250126_143052.mp3
Config Files / (root) check Downloaded from Nextcloud
Database /databases/ bloodhound.db SQLite tracking history
Settings SharedPreferences Default Nextcloud credentials, SMS triggers

Accessing Files via ADB

# Pull all photos from device
adb pull /data/data/me.dbarnett.bloodhound/files/Pictures/ ./photos/

# Pull location data
adb pull /data/data/me.dbarnett.bloodhound/files/Location/ ./location/

# Pull audio recordings
adb pull /data/data/me.dbarnett.bloodhound/files/Recordings/ ./audio/

# View tracking history database
adb pull /data/data/me.dbarnett.bloodhound/databases/bloodhound.db ./

Nextcloud Upload Paths

Captured data is automatically uploaded to corresponding directories on your Nextcloud server:

  • Photos → Nextcloud/Bloodhound/Pictures/
  • Location → Nextcloud/Bloodhound/Location/
  • Recordings → Nextcloud/Bloodhound/Recordings/

Storage Notes

  • App-Specific Storage: All files use context.getFilesDir() (app-specific storage)
  • No External Storage: The app doesn't require external storage permissions for normal operation
  • Automatic Cleanup: Files remain on device until manually deleted or app is uninstalled
  • Privacy: All data stored in app-private directory, inaccessible to other apps
  • Backup: Data is NOT backed up by Android's Auto Backup feature (by design)

Technology Stack

  • Language: Java
  • Build System: Gradle 8.8
  • Android SDK: API 34 (Android 14)
  • Architecture: AndroidX with Material Design
  • Storage: SQLite for tracking history
  • Cloud: Nextcloud Android Library

Known Limitations

  • Credentials Storage: Nextcloud credentials are stored in plain text in SharedPreferences (temporary limitation - encryption planned).
  • Background Restrictions: Modern Android versions restrict background services. Foreground service implementation recommended.
  • SMS Restrictions: Background SMS access is restricted on newer Android versions.

Recent Updates (2025)

This project has been modernized from the original 2017 codebase:

  • ✅ Updated from Android SDK 25 → SDK 34
  • ✅ Migrated from Support Library → AndroidX
  • ✅ Updated Gradle 3.3 → 8.8
  • ✅ Fixed Android 12+ compatibility issues
  • ✅ Updated all dependencies to latest versions
  • Migrated from legacy Camera API to CameraX (November 2025)
    • Eliminated deprecated android.hardware.Camera API
    • Removed 1x1 pixel SurfaceView overlay hack
    • Improved battery efficiency and capture speed
    • Better compatibility with modern Android versions

Contributing

Contributions are welcome! Please ensure:

  1. All features respect user privacy
  2. Code follows existing architecture patterns
  3. Tests are included for new features
  4. Documentation is updated

License

See license.txt for details.

Disclaimer

The developers of this software are not responsible for any misuse. Users must comply with all applicable laws regarding device tracking and privacy in their jurisdiction. Always obtain proper authorization before tracking any device.

About

A free and open source device tracker for Android.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Java 100.0%