Working on an update for an existing (live) ionic/cordova app. When making an android upgrade test to the new version of the app, all data of the old version is lost.
I first thought it has something to do with the storage plugin, so I reverted it and used the exact same storage implementation as the existing app. I even prevented all data migration and such. But no luck.
So I decided to check out 1 year old code and make a debug build of the existing app, sign it and compare the storage to the current version of the app. The result is:
The existing app gets served under "localhost/"
The new app gets served under "https://localhost/index.html"
Connecting the chrome debugger and changing the URL in the new app to "localhost/" and the old data is there again.
So my question is: how do i make sure that the app gets served under the same url as it did for the last years?
Finally found an answer myself and want to share: cordova-android 10 got a breaking change which switches from file scheme to https scheme when serving the app. Adding <preference name="AndroidInsecureFileModeEnabled" value="true"> to config.xml reverts this behaviour and still uses the file scheme.
Answered By – mic