I have a Hybrid Android app and I'm trying to send a binary image file from Android to a webview so that I can use JavaScript to rotate/crop it.
I tried converting it to a base64 string and sending it that way but it took way too long and sometimes would never finish sending. This is what I have currently:
public String bitMapToBase64(){
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
//add support for jpg and more.
bitMap.compress(Bitmap.CompressFormat.PNG, 50, byteArrayOutputStream);
byte[] byteArray = byteArrayOutputStream .toByteArray();
String encoded = Base64.encodeToString(byteArray, Base64.DEFAULT);
return encoded;
}
Is there a way to send the data as binary and receive it as binary on the webview and then convert it to a File object with JavaScript?
Is there a more efficient way of trying to do this?