Android蓝牙多连接问题? [英] Android Bluetooth multiple connection issue?

查看:26
本文介绍了Android蓝牙多连接问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Android 新手,我正在做一个项目,我必须将我的设备与所有设备连接起来,这些设备可以通过 startDiscovery() 调用使用蓝牙.我已经完成了蓝牙聊天示例,但问题是为了建立连接,我需要点击列表中的搜索设备项目,但我想发送数据列表中所有设备上的对象......是否可以使用 listenUsingInsecureComm..,?但是我不知道如何在未经许可的情况下与其他搜索设备配对(接收设备不需要单击是进行配对)?

I am new in Android, I am working on a project where I have to connect My device with all devices which can be found in by startDiscovery() call Using Bluetooth. I have gone through with bluetooth chat sample, but issue is that for make connection I need to click on item of search-devices in the list, but I want to send data object on all the devices in the list.. is that possible with listenUsingInsecureComm..,? but I am not getting the way how to pair with other search devices without permission (that the receiving device dont need to click Yes for pairing)?

我也在这里访问了相关问题,但无法得到我的解决方案.

I also visited related question here but can't get my solution.

推荐答案

我不知道确切但根据 Bluetooth chat 代码,为了建立更多连接,您必须制作 数组BluetoothDevice 并且您还必须为所有连接管理单独的线程.意味着您必须创建线程数组来从远程设备读取和写入数据,并且每个线程将仅与一个设备相关联意味着设备 1 有一个线程 1,设备 2 有一个线程 2,依此类推.

I don't know exactly but according to Bluetooth chat code for making a more connection you have to make array of BluetoothDevice and also you have to manage separate threads for all connections. means you have to make array of threads for reading and writing data from remote devices and each thread will associated with only one device means for device 1 there is a thread1 and for device 2 there is a thread 2 and so on.

这篇关于Android蓝牙多连接问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆