@UniJSMethod(uiThread = true)
public void getPicture(String picture , UniJSCallback callback){
Bitmap photo = EidSDK.parseCardPhoto(picture);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
//把bitmap100%高质量压缩 到 output对象里
photo.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
String s = Base64.encodeToString(outputStream.toByteArray(), Base64.DEFAULT);
JSONObject jsonObject = new JSONObject();
jsonObject.put("picture" , s);
callback.invoke(jsonObject);
}
callback.invoke(jsonObject);次方法中jsonObject数据长度有限制,返回给前端页面的数据会被截断
3 个回复
it_dyh
您好,请问一下怎么解决
LAO_WUUAN
var params = {
name: '张三',
age: 20,
gender: '男',
...
};
UniJSCallback.invoke('funcName', JSON.stringify(params), function() {...});
it_dyh
好的,谢谢,我试试