# Proximity Beacon (companion Android app) A minimal beacon app that replaces third-party iBeacon apps. It exists to fix the two phone-side reliability problems documented in `docs/HANDOFF.md` and AGENTS.md: 1. **BlueZ dedupes identical RSSI values**, so a stationary phone goes silent in the desktop's event stream. This app rotates the advertised `ServiceData` counter every 10 s (`AdvertisingSet.setAdvertisingData`), which makes BlueZ emit `PropertiesChanged` even when the RSSI repeats. The desktop daemon treats any `Device1` property update as a sighting. 2. **Beacon apps get frozen by Android doze / battery optimization**, pausing advertising for stretches. This app advertises from a foreground service (`connectedDevice` type) with a persistent notification, and offers a one-tap battery-optimization exemption. The advertisement is legacy, connectable and scannable at ~1 Hz (`INTERVAL_HIGH`): connectable so the desktop's pre-lock connect probe can attach, ~1 Hz to match the daemon's duty-cycle assumptions. Payload: 16-bit service UUID `0xFCA7` (unassigned) + 8-byte rotating counter. No stable identifier — privacy comes from the phone's rotating private address, which only the bonded desktop can resolve. ## Build Requires JDK 17+ (Android Studio's bundled JDK works): ```sh cd android ./gradlew assembleDebug # -> app/build/outputs/apk/debug/app-debug.apk ``` Install: `adb install app/build/outputs/apk/debug/app-debug.apk`, or copy the APK to the phone and open it. ## Use 1. Open "Proximity Beacon", grant the advertising/notification prompts. 2. Tap "Exempt from battery optimization" (the point of the app). 3. Tap "Start beacon"; keep the notification. Point the daemon's `device_mac` at this phone as before. If the beacon is running, the desktop journal should show sightings every few seconds even when the phone lies still — watch with `journalctl --user -u btle-proximity -f` while testing.