问题描述
我要寻找一种方式来开始在我的应用程序在Android手机和耳机之间的音频连接。这样做是为了简化以这样的方式连接过程,用户不必经过不同的设置菜单了(应用程序 - >设置 - >无线和Networs - >蓝牙设置)。
I am looking for a way to initiate the audio connection between the Android phone and my headset within my application. The idea is to simplify the connection process in such a way that the user doesn't have to go through the different settings menus anymore (Apps -> Settings -> Wireless & Networs -> Bluetooth settings).
这两种设备都被认为是已经配对和耳机的蓝牙地址是已知的。
Both devices are supposed to be already paired and the Bluetooth address of the headset to be known.
据我了解,蓝牙功能(可自Android SDK的2.0版本)仅限于蓝牙发现和RFCOMM通道(主机/客户端)的Android手机和蓝牙设备之间的连接。有另一种方式到Android系统上要求的蓝牙配置文件,以启动从一个应用程序到已知设备的连接,或者这是不可能的?
As far as I learned, the Bluetooth capabilities (available since version 2.0 of the Android SDK) are restricted to Bluetooth discovery and the connection of RFComm channels (host/client) between the Android phone and a Bluetooth device. Is there another way to request Bluetooth profiles on the Android system to initiate a connection to a known device from an app or is this impossible?
推荐答案
你看的的类?这似乎是你可以做你通过这个类需要,除非我误解了问题的一切。
Have you looked at the BluetoothAdapter class? It seems like you can do everything you need via that class, unless I misunderstand the question.
作为启动到特定设备的连接,不会对手机自动配对与已知的设备,一旦启用蓝牙?
As for initiating a connection to a specific device, won't the phone auto-pair with the known device once you enable bluetooth?
这篇关于编程从一个Android应用程序连接到蓝牙耳机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!