エミュレータで Bluetooth オーディオをテストする
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Wear OS エミュレータの場合、Wear OS 4 以降を搭載したシステム イメージには次のものが含まれます。
エミュレートされた Bluetooth のサポート。このサポートにより、Bluetooth オーディオに関連するいくつかのユースケースをテストできます。
エミュレートされたスマートフォンとペア設定する
エミュレータの Bluetooth サポートを使用すると、エミュレートされたスマートフォンとペア設定できます。これを行うには、コマンドラインから設定ウィザードを有効にします。
-append-userspace-opt androidboot.setupwizard_mode=REQUIRED
エミュレートされた出力デバイスから音声を再生する
エミュレータの Bluetooth サポートを使用すると、エミュレートされた Bluetooth 出力デバイスを通じた音声再生も可能です。エミュレータで音声出力の切り替えをテストするには、オープンソースの Bumble プロジェクトを使用して、エミュレートされた Bluetooth 出力デバイスに接続します。
環境を準備する
Bumble を使用するために開発マシンを準備する手順は次のとおりです。
Bumble ソースコードを取得します。
git clone https://github.com/google/bumble
bumble
ディレクトリに移動し、Bumble モジュールをビルドしてインストールします。
cd bumble && python3 -m pip install "."
エミュレートされた Bluetooth スピーカーを起動する
エミュレートされたスピーカーを起動する手順は、次のとおりです。
Wear OS 4 以降をサポートするバージョンのエミュレータを起動します。
注: エミュレータ バージョンを使用している場合
バージョン 33.1.10 より前のバージョンでは、
-packet-streamer-endpoint default
パラメータ。
エミュレートされたスピーカーを検出して接続するには、bumble
ディレクトリで次のコマンドを実行します。
python3 examples/run_a2dp_sink.py examples/a2dp_sink1.json \
android-netsim stdout | ffplay -i
音声出力はパソコンのスピーカーから再生されます。
出力をファイルにリダイレクトすることもできます。
python3 examples/run_a2dp_sink.py examples/a2dp_sink1.json \
android-netsim output.sbc
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-27 UTC。
[null,null,["最終更新日 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 ```"]]