File not found on Android <= 5


#1

I’m using cordova-transfer-plugin and cordova-file-plugin to download and store video files.

I store it using this.file.dataDirectory + 'path/to/downloads/video.mp4'.

When I test this on an emulator with API 22 (=Android 5.1), my video player doesn’t seem to find the file. So I look for it using

adb shell
run-as com.ionicframework.something
cd files/path/to/downloads
find video.mp4

Output:

root@generic_x86:/data/data/com.ionicframework.something/files/path/to/downloads $ find video.mp4
sh: find: not found

He finds the folders, but not the file… But the file has to be somewhere, because my app has increased in size with the same amount as the video size.

When I do the exact same thing using an emulator with API >=23, the file is found (and of course, my video player can play it):

generic_x86:/data/data/com.ionicframework.something/files/path/to/downloads $ find video.mp4
video.mp4

Notice that the word “root” is gone before “generic”. I don’t know why.

Is this a bug in the emulator? Or should I use something different than this.file.dataDirectory? According to the docs, API 22 should be supported.

Update:

ls -R
shows the file. I guess the command find is not available with API 22. But why does my video player keeps saying the file is not found…?