microsoft / ace

Build Cordova apps with true native UI
http://microsoft.github.io/ace
Other
850 stars 157 forks source link

How to use javascript Uint8array as parameter of ace.Native.Invoke helper #76

Open airomyas opened 7 years ago

airomyas commented 7 years ago

I'm using cordova file plugin to retrieve a jpg picture from sd card and I need to pass this picture to java side through Ace's native invoker.

Here is part of my code:

javascript side: fileEntry.file(function (file) { var reader = new FileReader(); reader.onloadend = function() { console.log("Successful file read: " + this.result); var className = ace.valueOn({ android: "videotest.VideoTest"}); ace.NativeObject.invoke(className, "startFull360View", new Uint8Array(this.result), size, index, function(result){});

java side: public static int startFull360View(byte[] img, int len, int index) { LOG.e("Full360View", "size is " + len); ...

When I do this there is no error message appear on the logcat but it doesn't work, Anyone could help?