简体   繁体   English

连接蓝牙设备时如何防止android选择Bluetooth A2DP路由

[英]How to prevent android to select Bluetooth A2DP route when bluetooth device is connected

I'm using MediaRouter (from v7 support library) and programmatically select route for audio to my specific device route, but when some bluetooth A2DP device is connected, Android automatically selects route associated with that bluetooth device. 我正在使用MediaRouter(来自v7支持库),并以编程方式为我的特定设备路由选择音频的路由,但是当连接了某些蓝牙A2DP设备时,Android会自动选择与该蓝牙设备关联的路由。

How can I prevent it from switching from my already selected and desired route? 如何防止它从我已经选择并想要的路线切换?

Well, it seems like there is no way to do it so far. 好吧,到目前为止似乎还没有办法。

Auto switching to the Bluetooth A2DP route is hardcoded into Android framework MediaRouter class 自动切换到蓝牙A2DP路由被硬编码到Android框架MediaRouter类中

This will select the active BT route if there is one and the current selected route is the default system route, or if there is no selected route yet. 如果存在一个且当前选择的路由是默认系统路由,或者尚无选择的路由,则将选择活动的BT路由。

So, if your current route is default one, BT A2DP route will be automatically selected. 因此,如果您当前的路由为默认路由,则将自动选择BT A2DP路由。 It is possible to listen to onRouteSelected callback and select your default route back. 可以监听onRouteSelected回调并选择默认的返回路由。

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

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