Important! A new Community experience launched on September 26, 2017. Read more about it here or continue to Base Camp.
Vote up!
0 Votes
1 Replies

How to return rawBytes from FFI?

Question asked by Ganesh Kelam on Feb 22, 2017 07:22 EST

I am developing a camera FFI plugin for Kony on Android environment. In this FFI, I have a method to return captured image as byte[] i.e rawBytes. Here is my FFI method code public JSONObject getImageRawBytes(String imageID) {         byte[] result = null;         JSONObject jObject = null; // ImageHelper will return byte[] here.         result = ImageHelper.getRawBytes(imageID);         jObject = new JSONObject().put("RAWBYTES", result);         return jObject;         } But in JS, I am getting "RAWBYTES" value as [B@1ba4059f. I would like to get this as ArrayBuffer in JS. Any ideas will be helpful.

Vote up!
0 votes
Vote down!

Hi Ganesh,

You cannot pass rawbytes as input to a service (as defined in Kony Middleware Server). You should convert the bytes to base64 string and send it as string input to the service.

Open Media Callback on android provides rawbytes which is the uri of the image when you print it it gives you the path. Convert that uri to actual file path of the image and resize,compress it and return the required base64 data back to JS layer.

Please find the sample app that we made where the pdf is converted to byte array and is converted to Object and the same we can get in kony through FFI callback. The datatype which we get from FFI is an Javascript Object type.

Thank You

Replied by: Apr 06, 2017 13:50 EDT