简体   繁体   中英

Can I send a message via bluetooth to multiple devices at the same time?

The code I'm using is:

ContentValues values = new ContentValues(); 
String filePath1 = Environment.getExternalStorageDirectory().toString() + "/filename.txt";
values.put(BluetoothShare.URI, Uri.fromFile(newFile(filePath1)).toString()); 
values.put(BluetoothShare.DESTINATION,itDevices.getAddress());
values.put(BluetoothShare.DIRECTION, BluetoothShare.DIRECTION_OUTBOUND); 
Long ts = System.currentTimeMillis(); 
values.put(BluetoothShare.TIMESTAMP, ts); 
Uri contentUri = getContentResolver().insert(BluetoothShare.CONTENT_URI, values);

How can I adapt this to send data to multiple devices at once?

Yes, It is pretty much possible. The official Bluetooth specifications state seven/7 is the maximum number of Bluetooth devices that can be connected at once. And around 248 is the limit for paired devices

However, three to four devices is a practical limit, depending on the types of devices and profiles are used. Some profiles require more Bluetooth data, so they are more demanding than other profiles. Data-intensive profiles may reduce the total number of devices that can be active at the same time. If a Bluetooth device becomes slow to connect or does not perform reliably, reduce the total number of connected devices.

See this answer which can be of your help

You can pair your device(say X) with any number of devices. But if device A is connected with X, device B won't be able to connect at all. You have to disconnect X from A and then connect X with B. Multiple connections at an instant is not allowed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM