android - 连接外部蓝牙设备并开始接收数据

标签 android

想要连接到设备并开始从外部设备接收数据 现在可以列出设备并与之配对......现在希望连接到它并开始从它接收数据

Is there any way because i dont exactly know wat kind of data it is sending 
means in which formate etc ...

即蓝牙设备不断向应用程序发送数据,因此应用程序应该不断接收数据

最佳答案

使用listenUsingRfcommWithServiceRecord代替 这段代码在服务中

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

关于android - 连接外部蓝牙设备并开始接收数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14277046/

相关文章:

android - 在 Jenkins 中显示 Android Lint 结果

android - 表达式中 ObservableFields 的 get()

android - Firebase 使用预构建的 UI 登录 Facebook 登录不起作用;显示登录错误 : There is an error in logging you into this application

android - 转换结果 findViewById android 方法

java - 安卓 : How to create a jagged array dynamically taking values from the database

Android : Preview frame, 从 YCbCr_420_SP (NV21) 格式转换为 RGB 渲染正确的图片,但为绿色

java - 如何在android studio中更改按钮的高度和宽度以及通过drawable canvas添加按钮?

使用 phonegap 的 android tcp/ip 客户端

android - 当子组件大小发生变化时,如何调整组件的大小以适应其子组件并保持不变? (Jetpack 撰写)

android - popbackstack 时如何清除编辑文本值