How to send message between two Android devices via bluetooth or BLE? -


is possible send messages bi-directionally between 2 android devices via bluetooth or bluetooth low energy? can assume each android device has same android app running. if so, please share how might possible? thanks!

yes can possible, not easy. first need read documentation

android bluetooth

and later try find example resemble needs.

example : bluetooth chat

comment : did communication android special hardware (i think ftdi chip), xamarin .net. things same. done ui, creating communication , data transfer in separate thread. in reading thread have endless cycle in reading bytes input stream , save temp buffer (impeding receipt , not lose bytes). later moves mainbufferu , work them.

update

you have read documentation , explore example. can not describe here. can describe lifecycle of how dealt itself: when have paired device (you bluetoothdevice) start connectthread opens rfcommsocket , try connect on it. if ok, start connectedthread have endless cycle of reading data inputstream. in cycle put data temp buffer , once in while moved data mainbuffer take them processing. if want send data via bluetooth, write outputstream in connectedthread.


Comments