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,["# 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."]]