Skip to content

Convert byte array to int and float #207

Discussion options

You must be logged in to vote

React native has a limitation on what data can be transferred between Javascript and native bridge. The connection defaults to string, so you're always going to need to keep this in mind.

Rfcomm is good
Delimiter does nothing
Charset does nothing
All due to binary using byte array connection

On read the byte array is being converted to a string with this

Base64.encodeToString(arr, Base64.DEFAULT);

So on the Javascript side you need to reverse this into a byte array and then I to the ints and floats based on the communication protocol.

If you need, you can always write a custom connection that performs the conversion on Java and then send ints and floats to Javascript as strings to just p…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@ValentinOsvaldo
Comment options

@scalhoun
Comment options

Answer selected by ValentinOsvaldo
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants