0

I need to deliver a new version of my app but have the following problem:

Until now, I used a feature allowing users to save images on the SD card, in a specific folder.

In my new version, I changed the code to save the images in the folder targeted by the method getExternalFilesDir().

Because of this, I need to move all the images from the previous location to the new one on all the current installations.

How to handle this? I know how to do it for database changes, but how to manage this during an app update?

Basically I would need a simple check like this:

if(previousVersion < 15) {
    moveFiles();
}

An other way would be to know if the user is doing a new install or an update:

if(newUpdate){
    moveFiles();
}

Thank you!

Yoann Hercouet
  • 17,894
  • 5
  • 58
  • 85
  • Since they have a new version, and you know that the code will only run IF it's a new version since they won't have it if it's not, you don't need to do a version check, and I would think you can just do a check on app load to see if the new location DOESN'T exist (first), then check the old location to see if it DOES exists, then and only then and then process a move of the files between the two locations, then delete the old location. Thoughts? – Gary Schreiner May 09 '14 at 06:13
  • Yes it will be my second option if there is no straight way to check it. – Yoann Hercouet May 09 '14 at 06:26
  • There is no "previous version" check. And if there were it still wouldn't tell you about the file location. If you put out version 16, then you that the previous version was 15 or less, there's no need to check for it, and can assume that will be true. But that doesn't mean they actually ever ran the app and have files in the previous location. You need to check if the files exist in one place, don't in the other, and move if both of those are true. – Gary Schreiner May 09 '14 at 06:29

0 Answers0