Filesystem plugin installation and usage
The problem with a native camera is that it stores captured pictures in a temporary folder. For example, the imageURI
from the camera plugin taken on an iPhone might look like this: file:///var/mobile/Containers/Data/Application/AB784267-B994-4B54-A81C-EF1180B18738/tmp/cdv_photo_005.jpg
.
Next time you run the application, this tmp
folder might be cleared. Here are a few possible solutions to the issue:
Use base64 data of the picture and store in the internal application's database
Move the picture to the persistent store where mobile OS is not able to remove files if more space is needed
The first option doesn't work because there is a limit for database file size and, on modern devices, pictures can be really high-quality and, thus, large. I tried to use this approach and was able to save only three pictures on an iPhone 5. Four pictures were taking more space in the database than is allowed.
So, I followed the second approach. There is a good Cordova...