19 Companion Device pairing
José Rebelo edited this page 2023-05-14 14:35:03 +01:00

On phones running Android 8.0 (API level 26) and higher, it's possible to use companion device pairing. It is recommended to use this setting, especially on Android 10 and higher as without it for example the Find phone feature cannot work correctly.

After the device is paired using this method, the device can leverage the REQUEST_COMPANION_RUN_IN_BACKGROUND permission to start the app from the background. This provides a better way for Gadgetbridge to keep its service running, read more about background service stability here.

In the future there might be a possibility to use companion device pairing to perform a Bluetooth (or Wi-Fi) scan of nearby devices, without requiring the ACCESS_FINE_LOCATION or BLUETOOTH_ADMIN permission. This would minimize the number of permissions needed. Currently, these permissions are still required. See more details here: https://developer.android.com/guide/topics/connectivity/companion-device-pairing

To utilize this in Gadgetbridge, enable "CompanionDevice Pairing" in the settings:

Settings > Developer Options > Discovery and Pairing options > CompanionDevice Pairing

and add your new device via the plus icon icon.

Pairing existing devices as companion

For devices already in Gadgetbridge, you must re-pair (re-bond) them:

  • Connect to the device:
  • Go to the Debug activity:
  • Click the "Pair current device as companion" button:
  • Select OK on the Link question: