Build and install¶
Bench hardware only. Never connect TwiistOff to a pump that is attached to a person.
Requirements¶
- JDK 17+ and the Android SDK (platform 37, build-tools), or Android Studio (current stable), which bundles both.
- An Android phone with Bluetooth LE, Android 9 (API 28) or newer. Android 12+ uses the
BLUETOOTH_SCAN/BLUETOOTH_CONNECTruntime permissions; Android 9–11 uses location permission for scanning. The app asks for what it needs on first launch. Reconnecting to the bonded pump is a direct connect, not a scan: it needsBLUETOOTH_CONNECTon Android 12+ and no runtime permission before. It also asks for notifications, the battery-optimisation exemption and exact alarms, as AndroidAPS does (Permissions and files). - A real device: emulators do not provide a usable Bluetooth radio.
- Optional:
adbon a computer, for installing, logcat and the debug REST bridge.
Download a release APK¶
Each release has TwiistOff-X.Y.Z.apk attached (with a
.sha256 file), built from that release's tag by GitHub Actions. It is a debug build, so it includes the
REST bridge. Install it with adb install TwiistOff-X.Y.Z.apk or by opening it on the phone.
Each release APK is signed with a key generated on the build machine. Android will not install it over a
build signed with a different key, including an earlier release or your own local build (see the
INSTALL_FAILED_UPDATE_INCOMPATIBLE note below). Before you switch, note your pump's key and settings:
uninstalling clears them.
Build¶
Point Gradle at your SDK with a local.properties file in the repository root (it is gitignored —
never commit it):
sdk.dir=/path/to/Android/Sdk
Then:
./gradlew assembleDebug # APK: app/build/outputs/apk/debug/app-debug.apk
./gradlew testDebugUnitTest # unit tests: crypto round-trips, frames, payloads, CRCs, state decoding, log records
./gradlew installDebug # with a phone attached over adb
Or open the folder in Android Studio and run the app configuration.
The app version comes from gradle.properties (twiistoffVersionName, twiistoffVersionCode). Releasing a
version writes it there on main, so a build of main reports the latest released version, the same as its APK.
- If your shell's default
javais older than 17, setJAVA_HOMEto a 17+ JDK for the Gradle run (Android Studio ships a suitable JetBrains Runtime). - Reinstalling a build signed with a different key fails with
INSTALL_FAILED_UPDATE_INCOMPATIBLE:adb uninstall com.infusionset.twiistoff, then install again. That clears the key and blob stored in the app; you will need to enter them again.
The debug REST bridge¶
Debug builds serve a loopback-only HTTP bridge on the phone (127.0.0.1:8090); release builds do not
start it. Reach it from a computer through adb:
adb forward tcp:8090 tcp:8090
curl -s http://127.0.0.1:8090/status
The full route reference is the REST API. Do not expose the bridge beyond adb forward
on a machine you trust.
Live smoke test¶
tools/smoke.sh is a short live check against a real (bench) pump: bridge reachable, scan finds a
candidate, connect, bond reuse, arm, one decoded status frame, clean disconnect. It needs adb, curl,
the debug app installed and your pump's key in the environment (never hard-code it):
LTSS=<your pump's key, hex> ./tools/smoke.sh # Linux / macOS / Git Bash on Windows
Set ADB=/path/to/adb if adb is not at the script's default location.
Network behaviour¶
TwiistOff makes no calls to any vendor server. It talks to the pump over Bluetooth and serves only the loopback debug bridge. Analytics are a no-op: nothing is collected or sent.