android_studio/samples/connectivity/bluetooth/companion
2026-06-26 03:26:01 +04:00
..
src/main first commit 2026-06-26 03:26:01 +04:00
build.gradle.kts first commit 2026-06-26 03:26:01 +04:00
README.md first commit 2026-06-26 03:26:01 +04:00

Companion Device Manager Sample

This sample showcases the use of the Companion Device Manager (CDM) to find and associate devices.

How to use the sample:

  1. Use two devices running the sample
  2. In one device start the GATTServerSample
  3. In the other open the CompanionDeviceManagerSample)
  4. Click start button in the CDM sample

It should directly find the server and a system request will appear. Once accepted both devices will be associated. You can then connect (see ConnectGATTSample and receive (see CompanionDeviceSampleService) appear and disappear events (if running A12+).

Note: You can associate multiple devices. When the server closes and opens again a new mac address will be used, thus you need to associate them again.

License

Copyright 2022 The Android Open Source Project
 
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.