相关疑难解决方法(0)

在.connect()之后如何防止Android蓝牙RFCOMM连接立即死亡?

这个问题已经解决了!非常感谢布拉德,丹尼斯和瘾君子!你是英雄!:)

这是工作代码.它连接到Zeemote并从中读取数据.

=====代码=====

public class ZeeTest extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        try {
            for (int i = 0; i < 3; i++) {
                test();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private boolean connected = false;
    private BluetoothSocket sock;
    private InputStream in;
    public void test() throws Exception {
        if (connected) {
            return;
        }
        BluetoothDevice zee = BluetoothAdapter.getDefaultAdapter().
            getRemoteDevice("00:1C:4D:02:A6:55");
        Method m = zee.getClass().getMethod("createRfcommSocket",
            new Class[] { int.class });
        sock = (BluetoothSocket)m.invoke(zee, Integer.valueOf(1));
        Log.d("ZeeTest", …

android bluetooth motorola rfcomm

48
推荐指数
3
解决办法
6万
查看次数

如何查找串口蓝牙设备的UUID?

我想从串口蓝牙设备接收数据到android手机.但我不知道该设备的UUID如何找到该设备的UUID?

uuid android bluetooth

20
推荐指数
4
解决办法
7万
查看次数

标签 统计

android ×2

bluetooth ×2

motorola ×1

rfcomm ×1

uuid ×1