gpt4 book ai didi

android - 连接到三星 Galaxy 上的蓝牙套接字 SPP 时,在 android 2.1 中请求 'Pairing Request'

转载 作者:行者123 更新时间:2023-11-29 18:21:52 25 4
gpt4 key购买 nike

我正在尝试使用我的三星 Galaxy 平板电脑使用 "00001101-0000-1000-8000-00805F9B34FB" 的 UUID 通过 Socket SPP 连接到蓝牙,但这对我不起作用.

我试过使用以下方法:

Method m = device.getClass().getMethod("createRfcommSocket", new Class[] { int.class });
sock = (BluetoothSocket) m.invoke(device, Integer.valueOf(1));
sock.connect();

这工作正常,但每次我尝试连接时,它都要求配对请求 PIN,失败会导致蓝牙连接失败。

如何设置/保存配对信息,使其不会在每次连接时都提示配对请求。

最佳答案

我也遇到了这个问题。这可能是 Android ICS 问题。作为解决方法,您可以使用不安全的套接字

Method m = device.getClass().getMethod("createInsecureRfcommSocket", new Class[] { int.class });
sock = (BluetoothSocket) m.invoke(device, Integer.valueOf(1));
sock.connect();

关于android - 连接到三星 Galaxy 上的蓝牙套接字 SPP 时,在 android 2.1 中请求 'Pairing Request',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4947587/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com