How to send 5 bytes with the same value from Android device via bluetooth
Question
I have been using the Bluetooth chat example for transferring data over Bluetooth from my android device to another. I would like to know how to send 5 bytes with the value of: 0, 64, 0, 32, 152.
La solution 2
I believe I have solved my problem with this, and it works! thanks guys.
public static byte[] reset(){
byte[] values = new byte[]{0, 64, 0, 32, (byte) 152};
return values;
}
Autres conseils
your code will be same as that and might roughly look like this.
get BluetoothAdapter
then
create Socket for specific device
you can then get
InputStream and OutputStream
from Socket use them to
read() and write()
there may be many examples available.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow