Skip to content

feat(wearable): implement Bluetooth RFCOMM transport and auto-connect receiver for WearOS (#2843, #4) - #3918

Open
Saik2789 wants to merge 1 commit into
microg:masterfrom
Saik2789:feat/wearable-bluetooth-rfcomm
Open

Saik2789 wants to merge 1 commit into
microg:masterfrom
Saik2789:feat/wearable-bluetooth-rfcomm

Conversation

@Saik2789

@Saik2789 Saik2789 commented Oct 25, 2026 •

Copy link
Copy Markdown

Resolves #2843
Resolves #4

Summary

Implemented native Bluetooth RFCOMM transport and auto-connection for WearOS smartwatches in play-services-wearable.

As identified by @mar-v-in in #4:

"There is no Bluetooth code in microG's Wear implementation yet, it's just able to connect to an emulator via adb. For Bluetooth functionality, One first need to record the Bluetooth connection of a original Google setup and then implement it in microG. The protocol should be mostly the same as via adb, just a different transport layer."

This implementation builds upon the StreamWearableConnection transport layer introduced in microg/Wearable#4 to connect paired WearOS devices over Bluetooth RFCOMM without requiring ADB emulator forwarding.

Changes

  1. BluetoothConnectionThread (play-services-wearable/core/src/main/java/org/microg/gms/wearable/BluetoothConnectionThread.java):

    • Implements RFCOMM server socket (listenUsingRfcommWithServiceRecord) targeting the standard Google Wearable service UUID (0000DA28-0000-1000-8000-00805F9B34FB) with SPP fallback (00001101-0000-1000-8000-00805F9B34FB).
    • Implements active RFCOMM client socket (device.createRfcommSocketToServiceRecord) for connecting to paired smartwatches by MAC address.
    • Bridges the underlying BluetoothSocket streams into StreamWearableConnection.
  2. WearableBluetoothReceiver (play-services-wearable/core/src/main/java/org/microg/gms/wearable/WearableBluetoothReceiver.java):

    • Dynamically listens for:
      • BluetoothAdapter.ACTION_STATE_CHANGED: Discovers bonded smartwatches and starts connections when Bluetooth is enabled.
      • BluetoothDevice.ACTION_ACL_CONNECTED: Auto-connects when a paired wearable connects to the Android system.
      • BluetoothDevice.ACTION_BOND_STATE_CHANGED: Automatically creates ConnectionConfiguration and establishes the connection upon successful bonding.
    • Filters devices using BluetoothClass.Device.Major.WEARABLE (0x0700).
  3. WearableImpl Lifecycle Integration:

    • Updated enableConnection(String name) to start the BluetoothConnectionThread for smartwatch configs (connectionType == 0) and Bluetooth server listeners.
    • Updated disableConnection and closeConnection with NPE guards and clean thread lifecycle management.
    • Added stopBluetooth() and receiver unregistration on service shutdown.
  4. Manifest Permissions:

    • Added BLUETOOTH, BLUETOOTH_ADMIN, BLUETOOTH_CONNECT, and BLUETOOTH_SCAN permissions to play-services-wearable/core/src/main/AndroidManifest.xml.

Payout Information (BountyHub / Bounty #2843)

…ver for WearOS (microg#2843, microg#4)

- Add BluetoothConnectionThread providing RFCOMM server listening and client connection
- Add WearableBluetoothReceiver dynamically listening for ACL_CONNECTED and BOND_STATE_CHANGED
- Integrate Bluetooth RFCOMM lifecycle into WearableImpl enableConnection/disableConnection
- Add Bluetooth permissions to play-services-wearable core manifest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BOUNTY] WearOS Support [$2340] Wishlist: com.google.android.gms.wearable

1 participant