How simondankelmann/bluetooth-le-spam works
Project type and purpose
• This is a native Android mobile application (“Bluetooth LE Spam”) written in Kotlin.
• Purpose: generate and send phantom BLE advertisements (various protocols) and detect incoming BLE spam.
• It uses Android Jetpack (Room DB, ViewModel), Android BLE APIs, foreground/background services, and a local SQLite database.
File structure for architectural clues
• Top-level modules:
• app/ – the Android app module with source folders.
• fastlane/ – deployment pipeline (Appfile, Fastfile, metadata).
• Within app/src/main/java/de/simon/dankelmann/bluetoothlespam:
• ui/ + ViewModel packages → presentation layer (MVVM).
• Services/ + Callbacks/Interfaces → background BLE scanning & advertising services.
• AdvertisementSetGenerators/ → factory/strategy generators of protocol-specific BLE payloads.
• Database/Dao/Entities/Migrations → local persistence using Room.
• Handlers, Helpers, Constants, Enums → utility & business-logic support.
• MainActivity, SettingsActivity → entry points for UI.
Additional insights from README
• Key features: BLE advertisement spoofing (Apple, SwiftPair, Samsung, Lovespouse, etc.), iOS crash exploit, spam detector.
• Requires Android 8+ BLE APIs, runs entirely on the device, no external backend.
Main components
a. Presentation Layer
• Activities & Fragments
• ViewModels (Advertise, SpamDetector, Start)
b. Service Layer
• BluetoothLeScanService & BluetoothLeScanForegroundService
• BluetoothLeAdvertisementService & AdvertisementForegroundService
• LegacyAdvertisementService / ModernAdvertisementService (version forks)
• AdvertisementSetQueueHandler
c. Generators & Business Logic
• AdvertisementSetGenerators (strategy classes implementing IAdvertisementSetGenerator)
• Handlers (AdvertisementSetQueueHandler)
• Helpers & Constants (BluetoothHelpers, DatabaseHelpers, etc.)
d. Data Layer
• Room Database (AppDatabase)
• DAOs (AdvertiseDataDao, AdvertisementSetDao, …)
• Entities & Migrations
e. Android OS & BLE Subsystem
• Android BLE API (BluetoothLeAdvertiser, BluetoothLeScanner)
• Hardware radio
f. External Environment
• Target BLE-capable devices (phones, speakers, adult toys, etc.)
Relationships and data flows
• UI → ViewModel → calls Service (via Context.bindService or Intent).
• Service → AdvertisementSetQueueHandler → selects appropriate AdvertisementSetGenerator → builds BLE payload.
• Service → Android BluetoothLeAdvertiser → hardware radio → external device.
• Android BLE Scanner → BluetoothLeScanService → scan callbacks propagate to SpamDetector logic → ViewModel → UI notifications.
• Services & UI both read/write to Room database through DAOs.
Architectural patterns / design principles
• MVVM for UI separation (Fragments/Activities + ViewModels).
• Service pattern for long-running BLE tasks (foreground & background services).
• Repository-style access via Room (DAO + Entities + Migrations).
• Strategy pattern for AdvertisementSetGenerators.
• Callback/Observer pattern for BLE events.
Technologies & frameworks
• Kotlin, Android SDK (BLE, Services, Jetpack: ViewModel, Room)
• Gradle/KTS build scripts, ProGuard rules
• Fastlane for CI/CD and Play Store metadata
• GitHub Actions (build.yml)
Diagramming recommendations
• Labels: annotate arrowheads with method calls or intents, e.g., “startScan()”, “startAdvertising()”, “onScanResult()”.