I have an Ionic3 app that has been in production mode in the store for almost a year. An update from cordova-plugin-ionic-webview
to version 2.3.1 and UseScheme="true"
improves the performance enormously! However, the whole storage is deleted. This is really fatal for an app in production mode.
What can I do to keep or transfer the data in the storage?
What I tried
I tried with plugin cordova-plugin-ionic-migrate-localstorage
but does not work, maybe because my cordova-plugin-ionic-webview version is too new for this plugin.
The local storage is always associated with an exact scheme + host + port tuple.
So when you activate UseScheme="true"
, the scheme will change to ionic://
, so you will not have access to the other local storage anymore.
I see 3 ways how you can fix it:
You don't activate UseScheme="true"
. This should allow you to access the old local storage after migrating it with cordova-plugin-ionic-migrate-localstorage
.
You update your app with with the old webview and include a migration step yourself where you store the local storage to a persistent storage (SQLite, filesystem, etc). After a couple of weeks/months, you send out another update with the new webview and use the persistent storage. (This of course only works if people actually downloaded and started the version with the migration step. Users who did not do it will lose their local storage).
You take a look at the cordova-plugin-ionic-migrate-localstorage
code and try to migrate the old local storage to either the new local storage location, or to persistent storage.
In any case, you shouldn't use local storage in mobile apps anymore. Instead, you can use @ionic/storage
in combination with the sqlite plugin so this will not happen again in the future.