Move file from app's cache folder to app's file folder



I’m trying to move image files I’ve taken with the camera plugin to a persistent folder. I’m developing mostly for Android at the moment. Taking a picture works fine, the pictures are stored in the apps cache folder. A sibling of the cache folder is the files folder, and that’s where I try to move the pictures to. For that I take the uri of the picture and replace the last folder name (cache to files).

The promise that is returned by File.move() says it works, but when I browse the files folder there is no file at all but the file was removed from cache folder.

The stringfied result of the move function looks like this:
{"isFile":true,"isDirectory":false,"name":"1465304932589.jpg","fullPath":"/1465304932589.jpg","filesystem":"<FileSystem: files-external>","nativeURL":"file:///storage/emulated/0/Android/data/com.ionicframework.photoapp331732/files/1465304932589.jpg"}

What am I doing wrong? What am I missing here? Or is this a bug (not a feature)?


I don’t know what changed, but after restarting my machine, restarting my phone, recompiling the code, installing and executing it, it worked. My app now can move files from it’s cache folder to it’s file folder.