Files
btle-proximity/android
Bastian Mäuser b93c0134dd Add Debian packaging and arm64 cross build
cargo-deb metadata produces a .deb with the binary, the packaged user
unit variant, man page and example config; arm64 cross-builds as a
static musl binary via an isolated rustup and rust-lld (recipe in
README). Add MIT LICENSE for the package copyright.
2026-11-05 16:34:47 +01:00
..
2026-11-05 15:15:03 +01:00

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):

cd android
./gradlew assembleDebug
# -> app/build/outputs/apk/debug/app-debug.apk

Release builds are signed when keystore.properties (gitignored, see AGENTS.md) exists; otherwise they come out unsigned:

./gradlew assembleRelease
# -> app/build/outputs/apk/release/btle-proximity-beacon-release.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.