Android bluetooth connection
Thanks for your reply. And yes that was my idea aswell but you have to work with input and output streams. And the only thing i know that is usefull for is for sending files or stuff like that.So no idea how i should send some kind of a signal via that.
I've worked with Tcp/Udp but I'm not familiar with bluetooth. I can't say for sure but if you can transfer files, which is basically just an array of bytes, there's no reason to think you can't transfer your own byte/byte array.
You might only need a single byte to represent a command
commandByte = 1; // Represents command 1 (An Enum or something can be used to define the commands in a readable way)
Or if you need to transfer more information along with it, maybe a byte array like this would be better
commandByteArray[0] //could identify a commandcommandByteArray[1 to 4] //could be an integer (4 bytes) representing the length of total bytes needed to be readcommandByteArray[5 to 8] // could be an integer representing the ID of the sending device/usercommandByteArray[9+] //could be any additional data (if needed)
Unfortunately I can't really provide any help in how to use the streams to send/receive this info but if you can do it with files, I'm sure you can get it done with your own data.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now