Skip to the content.

The Android client

android/client is an app for a second Android phone that does what the iPhone app does: it links to the Android phone that holds the SIM cards (the one running Tether, android/app) and shows its calls, texts, contacts and call history. The SIM phone stays in a bag; you use the other phone.

   
Application id app.tether.client (name “Tether Client”); installs next to app.tether.android without touching it
Android 10 (API 29) or later: Bluetooth LE central with L2CAP channels (createInsecureL2capChannel); GATT pipe as fallback
Client kind "android" in sync (protocol §5, §5.1)
Languages English and Persian

What it does

Not done (yet)

Building

cd android
./gradlew :client:testDebugUnitTest :client:assembleRelease
adb -s <the client phone> install -r client/build/outputs/apk/release/client-release.apk

Same JDK, SDK, Maven mirror and optional signing key as the SIM phone’s app (see BUILD.md).

First run

  1. Install and open it; allow Nearby devices (Bluetooth), the microphone and notifications.
  2. Link › Pair: on the SIM phone open Tether and tap Pair, then point the camera at the code.
  3. Link › Allow running in the background (battery optimisation off), so the link survives Doze.
  4. Calls from Recents, Contacts or the Keypad go out through the SIM phone; incoming calls ring here.

The SIM phone accepts the iPhone and this client at the same time (protocol §5.1). Call audio goes to the device that answered or dialed; the other one shows the call as “on …” with Move here.

How it is built

Part Where
Session (handshake, sealed records, ping, stall) link/CentralSession.kt, on the shared android/core (CentralHandshake, SecureSession, RecordReader)
Reconnect rules link/LinkPolicy.kt (ClientLinkPolicy, pure, unit-tested)
Bluetooth (scan, GATT, L2CAP, GATT pipe) link/BleCentral.kt (one handler thread)
Identity (static key, pairing) link/Identity.kt (Android Keystore key on Android 12+, else a software key), LinkJournal
Synced state (port of the iPhone’s AppModel) model/ClientState.kt, routing in model/ClientCore.kt
Calls calls/CallTracker.kt (port of CallController, pure), calls/Telecom.kt (ConnectionService), calls/CallAudio.kt, calls/Playout.kt
UI ui/ (tabs, conversation, call screen, pairing scanner, tel: links)

Tests

There is no second Android phone or Bluetooth on the build machine, so the client’s stack is tested on the JVM against a fake SIM phone built from the shared core’s peripheral handshake (src/test/.../Harness.kt): the protocol vectors, pairing and every REJECT, a full sync in GATT-sized chunks, sending a text (placeholder → real row), the outbox on reconnect, an incremental sync with deletions from sync.ids, ping round trip, a stalled stream, an incoming call answered here with Opus audio both ways and hung up, an outgoing call, a call answered elsewhere and moved back, a dropped link ending local calls and call.list bringing them back; and the ported rules (playout buffer, hang-up guard, reconnect policy, search).

What needs a real second phone: Bluetooth itself (scan, L2CAP, the GATT pipe, reconnects through address changes), Telecom (ringing, Bluetooth headset and car routing), audio quality and echo cancellation, notifications, the camera scanner, and battery life with the link up.