Canvas Capture Save Gallery

Canvas Capture Save Gallery
0

#1

I want to capture the image and save it to the device
And I want to check it in the gallery.
The code below does not work
However, it appears that the log succeeded.

//js code
saveFile(picData) {
if (CC_JSB) {
let filePath = jsb.fileUtils.getWritablePath() + ‘render_to_sprite_image.png’;
this.label.string = jsb.fileUtils.getWritablePath();
let success = jsb.saveImageData(picData, 800, 400, filePath)

        if (success) {
            this.label.string ="save image data success, file: " + filePath;
        }
        else {
            this.label.string ="save image data failed!";
        }

        jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "showAlertDialog", "(Ljava/lang/String;Ljava/lang/String;)V", "title", "hahahahha");
    }
}

What should I do?