音频路由歌蓝牙编程? [英] Route Audio song to blue-tooth programmatically?

查看:161
本文介绍了音频路由歌蓝牙编程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

怎么听从蓝牙设备我的音频文件,编程?
我在前面和后面扬声器之间已经路线我的音频文件,而路由通过蓝牙。

How to listen my audio file from Blue-Tooth device, programmatically? I have already route my audio file in between front and rear speaker, while routing over Bluetooth.

推荐答案

如果将设备连接到蓝牙,音频通过设备播放将通过蓝牙流唯一正确的?

If the device is connected to a bluetooth, audio played through the device will be streamed through bluetooth only right?

因此​​,也许你可以先检查设备是否连接到蓝牙设备搭配:

So maybe you can first check whether the device is connected to a bluetooth device with :

AudioManager audioManager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
if(audioManager.isBluetoothA2dpOn()) {
    // Play audio...
}

Android的 AudioManager 类有更多的细节你可以钻进去。

Android's AudioManager class has more details what you can dig into.

如果蓝牙未连接,您可以以编程方式检查并连接到使用蓝牙机器人的

If the bluetooth is not connected you can programmatically check and connect to available bluetooth devices using Androids bluetooth package.

这篇关于音频路由歌蓝牙编程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆