Preserving existing storage when migrating to Ionic

Hi. We have developed an application with Ionic from scratch that we previously had developed with another framework (Appcelerator Titanium). When we test the new version of the application in Ionic, it is installed on the Android device correctly, replacing the previous one but it deletes all the data of that version it replaces. It deletes the directory of images that the user had attached, the databases directory where it is placed the SQLite DB so the user also loses the data that had been stored in it. It is as if the new version erased everything that was previously there and did a fresh clean install.

We have developed the Ionic application with Capacitor, all the names and the configuration is similar to the previous version, we have increased the android:versionCode by one compared to the previous version, the new version correctly replaces the previous one but deletes all user data.

Is there a way to configure in the new version in Ionic that does not erase the previous data that the user had created so that it can continue to be used in the new version?

So, you could try to name the app the same package ID, which could use the same sandbox as the previous app.

If that’s something you’ve tried already, another option would be to push an update of your older app and store all of that data remotely first, then push the new update, and read that remote data

Thanks for the help.
All the names and the configuration is similar to the previous version, we have increased the android:versionCode by one compared to the previous version, the new version correctly replaces the previous one but deletes all user data.
About saving data on the server is something we wanted to avoid, having the data locally we would like to continue using them if we can prevent them from being erased

Is the previous app a production version or a development version?

When an app is signed with a different certificate, the app will be first uninstalled and then installed and all the data will be lost, so if it’s a production version (installed from Google Play) and you install a development version from your computer it will be uninstalled. Same if both are development versions but the installed one was generated from a different computer, in that case you can search the certificate used and use the same on the other computer.

If the old app was targeting Android 6 or newer it should automatically backup the data and should be restored after the uninstall/install process, unless the old app had this on the AndroidManifest.xml <application android:allowBackup="false">, so verify that it’s not present. But I’m not sure if that backups images or just simpler data.

We also believed that it could be a matter of certificates but compiling with it the same thing continues to happen to us, all the images and the previous database are deleted.
We have also tried allowBackup (with true or false) and it keeps happening. We cannot find a solution.