Mobile app — Android
The Android client (mobile/android, Kotlin + Jetpack Compose, package
com.opendeck.app, minSdk 26) shows the live desktop stream and turns touches
and keys into input events for open-deck-server.
Requirements
- JDK 17+
- Android SDK (compileSdk 35),
ANDROID_HOMEset orlocal.propertieswithsdk.dir
Build & install
cd mobile/android
./gradlew installDebug # build + install on a connected device
./gradlew assembleDebug # APK at app/build/outputs/apk/debug/
./gradlew lint testDebugUnitTest
Pairing
Three ways to fill the connect form — all produce host/port/token:
- Manual — type the PC's LAN address (e.g.
192.168.1.10), port (default47821) and the pairing token printed by the server. - QR scan — scan the QR shown by a desktop companion app with the phone's
camera. It encodes
opendeck://connect?host=…&port=…&token=…; the manifestVIEWintent filter opens OpenDeck with the form pre-filled. - NFC tap — tap a tag holding the same URI (NDEF record). Works both from a
cold start (
NDEF_DISCOVEREDfilter) and inside the app (foreground dispatch). Any tag whose records contain anopendeck://connectURI fills the form automatically.
Then tap Connect.
Controls
- Touch the stream — absolute-pointer mouse control: tap = click, drag =
move/drag. Coordinates are scaled from stream pixels to desktop pixels via
mapToDesktop()using thedesktop_*/stream_*dims from thehelloframe, matchingContentScale.Fitletterboxing. - Bottom bar — ESC, TAB, ENTER, DEL and arrow keys.
- Hardware keys —
keyNameFor()maps AndroidKeyEvents (F1–F12, nav keys, etc.) to protocol key names.
NFC tools
Open NFC tools from the connect screen (or the NFC button in the deck top bar):
- Read — tap any NDEF tag to see its technologies and decoded records (URI / text / MIME / AAR / unknown). A pairing tag fills the connect form instead of opening the tools screen.
- Write — pick URI or Text, enter a value, tap Write — then tap a tag; the next scanned tag receives the record. Needs a writable NDEF/NdefFormatable tag.
Session focus mode
Toggle Session focus mode on the connect screen to keep OpenDeck in the
foreground during a session: OpenDeckAccessibilityService watches window
changes and brings the app back if you switch away. Requires the Accessibility
permission — the app links to system settings. The setting persists in
SharedPreferences.
Auto-disconnect on exit
MainActivity.onStop disconnects the WebSocket whenever a session is active —
home, recents or screen-off always ends the session.
Troubleshooting
- Can't connect — same subnet? LAN IP not
localhost? Port open in the PC's firewall? - Connects then drops — wrong/rotated token; the server generates a new random token each launch unless a custom one is set.
- Laggy picture — lower
--max-widthor--fpson the server. - NFC does nothing — device needs
android.hardware.nfc(optional feature; checkNfcAdapter.getDefaultAdapter), NFC enabled in system settings, and the tag held near the back of the phone. - Focus mode doesn't pull the app back — enable OpenDeck in system Accessibility settings; some OEM builds restrict background activity starts.