Testa l'audio Bluetooth sugli emulatori
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Nell'emulatore Wear OS, le immagini di sistema con Wear OS 4 o versioni successive includono
per il Bluetooth emulato. che ti consente di testare diversi casi d'uso
relative all'audio Bluetooth.
Accoppia con un telefono emulato
Utilizzando il supporto Bluetooth dell'emulatore, puoi eseguire l'accoppiamento con uno smartphone emulato. A
A questo scopo, abilita la configurazione guidata dalla riga di comando:
-append-userspace-opt androidboot.setupwizard_mode=REQUIRED
Riprodurre l'audio tramite un dispositivo di output emulato
Utilizzando il supporto Bluetooth dell'emulatore, puoi anche riprodurre l'audio tramite una
dispositivo di output Bluetooth emulato. Per testare il cambio di uscita audio
emulatore, connettiti a un dispositivo di output Bluetooth emulato utilizzando l'open source
Progetto Bumble.
prepara l'ambiente
Per preparare la tua macchina di sviluppo per l'utilizzo di Bumble, completa i seguenti passaggi
passaggi:
Recupera il codice sorgente Bumble:
git clone https://github.com/google/bumble
Vai alla directory bumble
, quindi crea e installa
Moduli Bumble:
cd bumble && python3 -m pip install "."
Avvia altoparlante Bluetooth emulato
Per avviare l'altoparlante emulato, completa i seguenti passaggi:
Avvia una versione dell'emulatore che supporti Wear OS 4 o versioni successive.
Nota: se utilizzi una versione dell'emulatore
precedente alla versione 33.1.10, avviare l'emulatore dalla riga di comando utilizzando
-packet-streamer-endpoint default
.
Per rilevare e connetterti all'altoparlante emulato, esegui questo comando
nella directory bumble
:
python3 examples/run_a2dp_sink.py examples/a2dp_sink1.json \
android-netsim stdout | ffplay -i
L'uscita audio viene riprodotta dagli altoparlanti del computer.
Puoi anche reindirizzare l'output a un file:
python3 examples/run_a2dp_sink.py examples/a2dp_sink1.json \
android-netsim output.sbc
I campioni di contenuti e codice in questa pagina sono soggetti alle licenze descritte nella Licenza per i contenuti. Java e OpenJDK sono marchi o marchi registrati di Oracle e/o delle sue società consociate.
Ultimo aggiornamento 2025-07-27 UTC.
[null,null,["Ultimo aggiornamento 2025-07-27 UTC."],[],[],null,["# Test Bluetooth audio on emulators\n\nOn the Wear OS emulator, system images that run Wear OS 4 or higher include\nsupport for emulated Bluetooth. This support lets you test several use cases\nrelated to Bluetooth audio.\n\nPair with an emulated phone\n---------------------------\n\nUsing the emulator's Bluetooth support, you can pair with an emulated phone. To\ndo so, enable the setup wizard from the command line: \n\n -append-userspace-opt androidboot.setupwizard_mode=REQUIRED\n\nPlay audio through an emulated output device\n--------------------------------------------\n\nUsing the emulator's Bluetooth support, you can also play audio through an\nemulated Bluetooth output device. To test audio output switching in the\nemulator, connect to an emulated Bluetooth output device using the open source\n[Bumble project](https://www.github.com/google/bumble).\n\n### Prepare your environment\n\nTo prepare your development machine for using Bumble, complete the following\nsteps:\n\n1. Fetch the Bumble source code:\n\n ```\n git clone https://github.com/google/bumble\n ```\n2. Navigate to the `bumble` directory, then build and install\n Bumble modules:\n\n ```\n cd bumble && python3 -m pip install \".\"\n ```\n\n### Launch emulated Bluetooth speaker\n\nTo launch the emulated speaker, complete the following steps:\n\n1. Launch a version of the emulator that supports Wear OS 4 or higher.\n\n **Note:** If you're using an emulator version\n lower than 33.1.10, launch the emulator from the command line using the\n `-packet-streamer-endpoint default` parameter.\n2. To discover and connect to the emulated speaker, run the following\n command in the `bumble` directory:\n\n ```\n python3 examples/run_a2dp_sink.py examples/a2dp_sink1.json \\\n android-netsim stdout | ffplay -i\n ```\n\n The audio output is played through your computer's speakers.\n\n You can also redirect output to a file: \n\n ```\n python3 examples/run_a2dp_sink.py examples/a2dp_sink1.json \\\n android-netsim output.sbc\n ```"]]