Images disappear when updating phonegap app

I have this phonegap app (ionic) which saves some data as json objects to localstorage and then display it in the view.

This is the form of the object when console.logged:

{
name: Jon Doe,
age: 45,
img: file:///var/mobile.....tmp/cdv_photo_007.jpg
}

The image is added using the phone gap camera plugin. Everything works like charm, but when I installed an update of the app, the images doesn't persist. All the other info in the locally stored objects, however, is still there. And if I edit the item which lacks an image and add a new image, the new image is shown. So the app pretty much works as expected, it's just that the reference to the image disappears when updating.

All help much appreciated!

There are two issues: 1. You are storing the image in /var/mobile.../tmp which is non-persistant (see https://github.com/apache/cordova-plugin-file/blob/master/doc/index.md)

  1. You are referencing the image by the absolute path, including the app UUID (hidden in the .... in your example) which changes on each new version. The file is copied to the new version directory under a new UUID and so the absolute path is no longer valid.