Reputation: 81
We are a group of computer science student, currently working on a project as part of our Master.
Our problem is as follows.
We are working on an app for Android that requires devices to exchange small amounts of data. This needs to work without mobile connections or existing WiFi networks, e.g. using Bluetooth, WiFi direct etc.
We have looked at Bluetooth smart, which allows a device to run advertising mode sending 31 bytes of data, this would be more than adequate for our needs. But it is only supported in Android 5.0 so this seriously limits our availability.
Message confirmation and error checking is a plus but it is not a requirement. So an Udp connection is a possibility.
All the solutions that we can find either involves the user actively accepting a peer request, which is not acceptable since there could be hundreds of devices communicating with each other, or rooting the device.
In short what we are looking for is a way for a device to broadcast a small amount of data, around 24 bytes is the minimum. Without the user needing to do anything other than starting up the app.
Upvotes: 2
Views: 3519
Reputation: 469
I was doing the similar project as you guys. Then I found out this:
https://stackoverflow.com/a/5886544/2989374
They are using createInsecureRfcommSocketToServiceRecord
and listenUsingInsecureRfcommWithServiceRecord
.
After testing I was able to send message between two unpaired device.
Hope this will help.
Upvotes: 0
Reputation: 535
Since I don't have enough reputation to reply to your comment, I'll have to write a response as an answer, and hope you read it.
To Mach: While it is true that 4.3 can act as a central device and as such act as a client, 5.0 was the android version that introduced the ability for the device to act as a peripheral device and act as a server and push information out. This is what most of my reading has lead me to believe. Am I missing something? If a central device is capable of advertising information, then what is the difference between central and peripheral devices?
Upvotes: 2
Reputation: 8395
Bluetooth Smart aka Bluetooth Low Energy (BLE) does not require a user-interaction upon pairing and is supported from API level 18, not 21. BLE does require that the phone has Bluetooth 4.0 hardware.
The fast scan and connection time (<5ms) is also a big plus for Bluetooth Low Energy.
By switching between Server and Client it would be possible to pass messages. Today most Android Bluetooth stacks permit 8 or more simultaneous GATT connections making it possible to have a rather effective mesh network.
There are today no pre-defined GATT profiles for what you are trying to do but there is a need and hopefully you will come up with a good solution.
Good luck!
Upvotes: 1