简体   繁体   English

(3.0之前的)Android程序可以连接到蓝牙A2DP设备吗?

[英]Can an (pre 3.0) Android program connect to a bluetooth A2DP device?

Can a program that is written using the gingerbread/froyo/eclair (eg 2.1, 2.2, 2.3 -> NOT honeycomb) connect to a A2DP bluetooth sink device?? 使用gingerbread / froyo / eclair(例如2.1、2.2、2.3-> NOT Honeycomb)编写的程序可以连接到A2DP蓝牙接收器设备吗? Or, do I need to have the user go to their settings to do so? 或者,是否需要让用户进入其设置才能执行此操作? Any help or advice would be highly appreciated. 任何帮助或建议,将不胜感激。

So, after much more research, it seems that it is impossible to programmatically connect to a A2DP device on a pre-3.0 Android device. 因此,经过更多研究,似乎不可能以编程方式连接到3.0之前的Android设备上的A2DP设备。 I am going mark this as the answer but, if someone finds otherwise, please correct me on this as I would really like to do it programmatically. 我将其标记为答案,但是,如果有人发现其他问题,请对此进行更正,因为我真的很喜欢以编程方式进行操作。

Can't you use BluetoothA2dp::connectSink()? 您不能使用BluetoothA2dp :: connectSink()吗? Create a BluetoothA2dp instance, then call connectSink(BluetoothDevice device) with the device you're trying to connect to. 创建一个BluetoothA2dp实例,然后使用您要连接的设备调用connectSink(BluetoothDevice设备)。

code: http://www.google.com/codesearch#uX1GffpyOZk/core/java/android/bluetooth/BluetoothA2dp.java&q=BluetoothA2dp&l=112 代码: http : //www.google.com/codesearch#uX1GffpyOZk/core/java/android/bluetooth/BluetoothA2dp.java&q=BluetoothA2dp&l=112

It seems like this API is not listed in the Android API reference for BluetoothA2dp though: http://developer.android.com/reference/android/bluetooth/BluetoothA2dp.html 似乎该API没有在BluetoothA2dp的Android API参考中列出: http : //developer.android.com/reference/android/bluetooth/BluetoothA2dp.html

So, after much more research, I found and verified that it is actually possible to use the hidden API's to connect to a a2dp device via bluetooth. 因此,经过更多研究,我发现并验证了实际上可以使用隐藏的API通过蓝牙连接到a2dp设备。 However, it seems that post-honeycomb, that method isn't possible anymore... I will post another question regarding that. 但是,似乎在蜂窝之后,该方法不再可用了……我将对此发布另一个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM