Ab dem 27. März 2025 empfehlen wir, android-latest-release
anstelle von aosp-main
zu verwenden, um AOSP zu erstellen und Beiträge dazu zu leisten. Weitere Informationen finden Sie unter Änderungen am AOSP.
Bluetooth
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Android bietet einen standardmäßigen Bluetooth-Stack, der sowohl Classic Bluetooth als auch Bluetooth Low Energy (BLE) unterstützt. Über Bluetooth können Android-Geräte Personal Area Networks erstellen, um Daten mit Bluetooth-Geräten in der Nähe zu senden und zu empfangen.
In Android 4.3 und höher bietet der Android-Bluetooth-Stack die Möglichkeit, BLE zu implementieren. Wenn Sie die BLE-APIs vollständig nutzen möchten, müssen Sie die Android Bluetooth HCI Requirements (Anforderungen an die Bluetooth-HCI-Schnittstelle von Android) einhalten. Auf Android-Geräten mit einem geeigneten Chipsatz kann entweder Classic Bluetooth oder sowohl Classic Bluetooth als auch BLE implementiert werden. BLE ist nicht mit älteren Bluetooth-Chipsätzen abwärtskompatibel.
In Android 8.0 ist der Bluetooth-Stack vollständig für Bluetooth 5 qualifiziert. Damit die verfügbaren Bluetooth 5-Funktionen genutzt werden können, muss das Gerät einen Bluetooth 5-kompatiblen Chipsatz haben.
Android-Architektur
Eine Bluetooth-App kommuniziert über Binder mit dem Bluetooth-Prozess. Der Bluetooth-Prozess verwendet Java Native Interface (JNI), um mit dem Bluetooth-Stack zu kommunizieren, und bietet Entwicklern Zugriff auf verschiedene Bluetooth-Profile. Dieses Diagramm zeigt die allgemeine Struktur des Bluetooth-Stacks:

Abbildung 1: Android-Bluetooth-Architektur.
- App-Framework
-
Auf der Ebene des App-Frameworks befindet sich der App-Code, der die
android.bluetooth
APIs verwendet, um mit der Bluetooth-Hardware zu interagieren. Intern wird mit diesem Code der Bluetooth-Prozess über den Binder-IPC-Mechanismus aufgerufen.
- Bluetooth-App
-
Die Bluetooth-App, die sich unter
packages/modules/Bluetooth/android/app
befindet, ist als Android-App verpackt und implementiert die Bluetooth-Profile auf der Android-Framework-Ebene. Diese App ruft den Bluetooth-Stack über JNI auf.
- JNI
-
Der mit
android.bluetooth
verknüpfte JNI-Code befindet sich unter packages/modules/Bluetooth/android/app/jni
. Der JNI-Code ruft den Bluetooth-Stack auf, wenn bestimmte Bluetooth-Vorgänge ausgeführt werden, z. B. wenn Geräte gefunden werden.
- Bluetooth-Stack
-
Der Standard-Bluetooth-Stack ist in AOSP enthalten und befindet sich unter
packages/modules/Bluetooth/system
. Der Stack implementiert die generische Bluetooth-HAL und passt sie mit Erweiterungen und Konfigurationsänderungen an.
- Anbieterimplementierung
-
Anbietergeräte interagieren über die HAL-Schnittstellendefinitionssprache (HIDL) mit dem Bluetooth-Stack.
HIDL
HIDL definiert die Schnittstelle zwischen dem Bluetooth-Stack und der Anbieterimplementierung. Um die Bluetooth-HIDL-Dateien zu generieren, übergeben Sie die Bluetooth-Schnittstellendateien an das HIDL-Generierungstool. Die Schnittstellendateien befinden sich in hardware/interfaces/bluetooth
.
Entwicklung des Bluetooth-Stacks
Der Android-Bluetooth-Stack ist ein vollständig qualifizierter Bluetooth-Stack. Die Qualifizierungsliste finden Sie auf der Bluetooth SIG-Website (Anmeldung erforderlich) unter QDID 169365.
Der Bluetooth-Kern-Stack befindet sich in
packages/modules/Bluetooth
. Die Entwicklung erfolgt in AOSP und Beiträge sind willkommen.
Alle Inhalte und Codebeispiele auf dieser Seite unterliegen den Lizenzen wie im Abschnitt Inhaltslizenz beschrieben. Java und OpenJDK sind Marken oder eingetragene Marken von Oracle und/oder seinen Tochtergesellschaften.
Zuletzt aktualisiert: 2025-08-22 (UTC).
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-22 (UTC)."],[],[],null,["Android provides a default Bluetooth stack that supports both Classic\nBluetooth and Bluetooth Low Energy (BLE). Using Bluetooth, Android devices\ncan create personal area networks to send and receive data with nearby\nBluetooth devices.\n\nIn Android 4.3 and higher, the Android Bluetooth stack provides the ability\nto implement BLE. To fully use the BLE APIs, follow the\n[Android Bluetooth HCI Requirements](/docs/core/connect/bluetooth/hci_requirements).\nAndroid devices with a qualified chipset can implement either Classic\nBluetooth or both Classic Bluetooth and BLE. BLE isn't backward compatible\nwith older Bluetooth chipsets.\n\nIn Android 8.0, the Bluetooth stack is fully qualified for Bluetooth 5. To\nuse available Bluetooth 5 features, the device needs to have a Bluetooth 5\nqualified chipset.\n\nAndroid architecture\n\nA Bluetooth app communicates with the Bluetooth process through Binder. The\nBluetooth process uses Java Native Interface (JNI) to communicate with the\nBluetooth stack and provides developers with access to various Bluetooth\nprofiles. This diagram shows the general structure of the Bluetooth stack:\n\n**Figure 1.** Android Bluetooth architecture.\n\napp framework\n: At the app framework level is app code, which uses the\n [`android.bluetooth`](http://developer.android.com/reference/android/bluetooth/package-summary)\n APIs to interact with the Bluetooth hardware. Internally, this code calls\n the Bluetooth process through the Binder IPC mechanism.\n\nBluetooth app\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\n Android framework layer. This app calls into the Bluetooth stack through\n JNI.\n\nJNI\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\n devices are discovered.\n\nBluetooth stack\n: The default Bluetooth stack is provided in AOSP and is located in\n `packages/modules/Bluetooth/system`. The stack implements the generic\n Bluetooth HAL and customizes it with extensions and configuration changes.\n\nvendor implementation\n: Vendor devices interact with the Bluetooth stack using the HAL interface\n definition language (HIDL).\n\nHIDL\n\n[HIDL](/docs/core/architecture/hidl) defines the interface between the\nBluetooth stack and the vendor implementation. To generate the Bluetooth\nHIDL files, pass the Bluetooth interface files into the HIDL generation\ntool. The interface files are located in\n[`hardware/interfaces/bluetooth`](https://android.googlesource.com/platform/hardware/interfaces/+/android16-release/bluetooth/).\n\nBluetooth stack development\n\nThe Android Bluetooth stack is a fully qualified Bluetooth stack. The\nqualification listing is on the Bluetooth SIG website (requires sign-in)\nunder [QDID 169365](https://launchstudio.bluetooth.com/ListingDetails/130825).\n\nThe core Bluetooth stack resides in\n[`packages/modules/Bluetooth`](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/modules/Bluetooth/).\nDevelopment happens in AOSP, and contributions are welcome."]]