Programmatically connect to paired Bluetooth speaker and play audio

前端 未结 4 1647
陌清茗
陌清茗 2020-12-15 22:59

In our app, I\'d like to connect to a previously paired A2DP Bluetooth Speaker and direct audio playback to it, using Android v4.2 or later.

I can successfully creat

4条回答
  •  我在风中等你
    2020-12-16 00:04

    Had the same problem, but found that older post:

    Programmatically connect to paired Bluetooth device

    In short, in order to connect to a paired a2dp device, you simply have to invoke BluetoothA2dp.connect(myPairedA2dpDevice), but right now that method is hidden from the public API, which is not helpful. So you access it through Java reflection. It's kind of a hack, but the way Google put it, there doesn't seem to be a clean solution for now.

提交回复
热议问题