Начиная с 27 марта 2025 г. мы рекомендуем использовать android-latest-release
вместо aosp-main
для создания и участия в AOSP. Дополнительные сведения см. в разделе Изменения в AOSP .
Bluetooth
Оптимизируйте свои подборки
Сохраняйте и классифицируйте контент в соответствии со своими настройками.

Android предоставляет стандартный стек Bluetooth, поддерживающий как классический Bluetooth, так и Bluetooth с низким энергопотреблением (BLE). Используя Bluetooth, устройства Android могут создавать персональные сети для обмена данными с находящимися поблизости Bluetooth-устройствами.
В Android 4.3 и более поздних версиях стек Bluetooth Android обеспечивает поддержку BLE. Для полноценного использования API BLE следуйте требованиям Android Bluetooth HCI . Устройства Android с соответствующим чипсетом могут поддерживать либо классический Bluetooth, либо оба варианта. BLE не имеет обратной совместимости со старыми чипсетами Bluetooth.
В Android 8.0 стек Bluetooth полностью квалифицирован для Bluetooth 5. Для использования доступных функций Bluetooth 5 устройство должно иметь чипсет, совместимый с Bluetooth 5.
Архитектура Android
Приложение Bluetooth взаимодействует с процессом Bluetooth через Binder. Процесс Bluetooth использует Java Native Interface (JNI) для взаимодействия со стеком Bluetooth и предоставляет разработчикам доступ к различным профилям Bluetooth. На этой диаграмме показана общая структура стека Bluetooth:

Рисунок 1. Архитектура Android Bluetooth.
- фреймворк приложения
- На уровне фреймворка приложения находится код приложения, который использует API
android.bluetooth
для взаимодействия с оборудованием Bluetooth. Внутри этот код вызывает процесс Bluetooth через механизм Binder IPC. - Bluetooth-приложение
- Приложение Bluetooth, расположенное в
packages/modules/Bluetooth/android/app
, упаковано как приложение Android и реализует профили Bluetooth на уровне фреймворка Android. Это приложение обращается к стеку Bluetooth через JNI. - JNI
- Код JNI, связанный с
android.bluetooth
, находится в packages/modules/Bluetooth/android/app/jni
. Код JNI обращается к стеку Bluetooth при выполнении определённых операций Bluetooth, например, при обнаружении устройств. - Bluetooth-стек
- Стек Bluetooth по умолчанию предоставляется в AOSP и находится в
packages/modules/Bluetooth/system
. Стек реализует универсальный Bluetooth HAL и настраивает его с помощью расширений и изменений конфигурации. - реализация поставщика
- Устройства-поставщики взаимодействуют со стеком Bluetooth, используя язык определения интерфейса HAL (HIDL).
ХИДЛ
HIDL определяет интерфейс между стеком Bluetooth и реализацией поставщика. Для генерации файлов Bluetooth HIDL передайте файлы интерфейса Bluetooth в инструмент генерации HIDL. Файлы интерфейса находятся в hardware/interfaces/bluetooth
.
Разработка стека Bluetooth
Стек Bluetooth для Android — это полностью сертифицированный стек Bluetooth. Список сертификации доступен на сайте Bluetooth SIG (требуется регистрация) под QDID 169365 .
Основной стек Bluetooth находится в packages/modules/Bluetooth
. Разработка ведётся в AOSP, и любые дополнения приветствуются.
Контент и образцы кода на этой странице предоставлены по лицензиям. Java и OpenJDK – это зарегистрированные товарные знаки корпорации Oracle и ее аффилированных лиц.
Последнее обновление: 2025-08-22 UTC.
[[["Прост для понимания","easyToUnderstand","thumb-up"],["Помог мне решить мою проблему","solvedMyProblem","thumb-up"],["Другое","otherUp","thumb-up"]],[["Отсутствует нужная мне информация","missingTheInformationINeed","thumb-down"],["Слишком сложен/слишком много шагов","tooComplicatedTooManySteps","thumb-down"],["Устарел","outOfDate","thumb-down"],["Проблема с переводом текста","translationIssue","thumb-down"],["Проблемы образцов/кода","samplesCodeIssue","thumb-down"],["Другое","otherDown","thumb-down"]],["Последнее обновление: 2025-08-22 UTC."],[],[],null,["# Bluetooth\n\nAndroid provides a default Bluetooth stack that supports both Classic Bluetooth and Bluetooth\nLow Energy (BLE). Using Bluetooth, Android devices can create personal area networks to send\nand receive data with nearby Bluetooth devices.\n\n\nIn Android 4.3 and higher, the Android Bluetooth stack provides the ability to implement\nBLE. To fully use the BLE APIs, follow the\n[Android Bluetooth HCI Requirements](/docs/core/connect/bluetooth/hci_requirements). Android devices with a qualified chipset can implement either Classic Bluetooth or both\nClassic Bluetooth and BLE. BLE isn't backward compatible with older Bluetooth chipsets.\n\n\nIn Android 8.0, the Bluetooth stack is fully qualified for Bluetooth 5. To use\navailable Bluetooth 5 features, the device needs to have a Bluetooth 5 qualified chipset.\n\nAndroid architecture\n--------------------\n\n\nA Bluetooth app communicates with the Bluetooth process through Binder. The Bluetooth\nprocess uses Java Native Interface (JNI) to communicate with the Bluetooth stack and provides\ndevelopers with access to various Bluetooth profiles. This diagram shows the general\nstructure of the Bluetooth stack:\n\n**Figure 1.** Android Bluetooth architecture.\n\napp framework\n:\n At the app framework level is app code, which uses the\n [`android.bluetooth`](http://developer.android.com/reference/android/bluetooth/package-summary.html)\n APIs to interact with the Bluetooth hardware. Internally, this code calls the Bluetooth\n process through the Binder IPC mechanism.\n\nBluetooth app\n:\n The Bluetooth app, located in `packages/modules/Bluetooth/android/app`,\n is packaged as an Android app and implements the Bluetooth profiles at the Android framework\n layer. This app calls into the Bluetooth stack through JNI.\n\nJNI\n:\n The JNI code associated with `android.bluetooth` is located in\n `packages/modules/Bluetooth/android/app/jni`. The JNI code calls into the\n Bluetooth stack when certain Bluetooth operations occur, such as when devices are\n discovered.\n\nBluetooth stack\n:\n The default Bluetooth stack is provided in AOSP and is located in\n `packages/modules/Bluetooth/system`. The stack implements the generic Bluetooth\n HAL and customizes it with extensions and configuration changes.\n\nvendor implementation\n:\n Vendor devices interact with the Bluetooth stack using the HAL interface definition\n language (HIDL).\n\n### HIDL\n\n\n[HIDL](/docs/core/architecture/hidl) defines the interface between the\nBluetooth stack and the vendor implementation. To generate the Bluetooth HIDL files, pass the\nBluetooth interface files into the HIDL generation tool. The interface files are located in\n[`hardware/interfaces/bluetooth`](https://android.googlesource.com/platform/hardware/interfaces/+/android16-release/bluetooth/).\n\n### Bluetooth stack development\n\n\nThe Android Bluetooth stack is a fully qualified Bluetooth stack. The qualification listing is\non the Bluetooth SIG website (requires sign-in) under\n[QDID 169365](https://launchstudio.bluetooth.com/ListingDetails/130825).\n\n\nThe core Bluetooth stack resides in\n[packages/modules/Bluetooth](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/modules/Bluetooth/). Development happens in AOSP, and contributions are welcome."]]