相关疑难解决方法(0)

以编程方式连接到配对的蓝牙设备

有没有办法使用Android SDK以编程方式连接到已配对的蓝牙设备?

换句话说:我可以进入设置 - >无线和网络 - >蓝牙设置,然后点击设备(列为"已配对但未连接"),此时它将连接.我希望能够以编程方式执行此操作,但是没有办法实现此目的.

我看到了创建RFCOMM套接字的选项,对于SPP设备,我假设它也会做连接部分,但是对于A2DP设备,实际数据传输将由OS处理,而不是由我的应用程序,我认为这不适用?

android bluetooth

52
推荐指数
2
解决办法
8万
查看次数

Android ICS上的蓝牙连接无法实现

我正在编写一个应用程序,它将平板电脑的字节代码发送到μ控制器.在联想A1(Androi 2.3)和三星Galaxy Tab 7 Plus N(Android 3.2)上一切正常.现在我遇到了新的三星Galaxy Tab 2(Android 4.0)的问题.

我能够配对蓝牙天线(连接到μ控制器并通过串行协议进行通信).当我启动应用程序时,我再次被要求输入密码并配对.输入配对密码后,我的主要布局可见,但未建立连接.

日食中的LogCat告诉我:

06-19 16:00:20.656: V/BluetoothSocket.cpp(3189): availableNative
06-19 16:00:20.664: V/BluetoothSocket.cpp(3189): abortNative
06-19 16:00:20.664: V/BluetoothSocket.cpp(3189): ...asocket_abort(49) complete
06-19 16:00:20.664: I/ActivityManager(185): No longer want com.google.android.partnersetup (pid 3220): hidden #16
06-19 16:00:20.671: V/BluetoothSocket.cpp(3189): availableNative
06-19 16:00:20.671: V/BluetoothSocket.cpp(3189): destroyNative
06-19 16:00:20.671: V/BluetoothSocket.cpp(3189): ...asocket_destroy(49) complete
06-19 16:00:20.679: D/KeyguardViewMediator(185): setHidden false
06-19 16:00:20.679: W/System.err(3189): java.io.IOException: socket closed
06-19 16:00:20.679: W/System.err(3189):     at android.bluetooth.BluetoothSocket.available(BluetoothSocket.java:370)
06-19 16:00:20.679: W/System.err(3189):     at android.bluetooth.BluetoothInputStream.available(BluetoothInputStream.java:40)
06-19 16:00:20.679: W/System.err(3189):     at java.io.BufferedInputStream.available(BufferedInputStream.java:114)
06-19 16:00:20.687: W/System.err(3189):     at ebs.alphadidact.control.ReceiveThread.run(ReceiveThread.java:79) …
Run Code Online (Sandbox Code Playgroud)

android bluetooth galaxy-tab

6
推荐指数
1
解决办法
9399
查看次数

标签 统计

android ×2

bluetooth ×2

galaxy-tab ×1