-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatic migration of localStorage when moving to android@10 / WebViewAssetLoader #1315
Comments
I'm not sure a migration option is needed. Looks like Google already thought of this when they added a "preserveLegacyExternalStorage" attribute: https://developer.android.com/reference/android/R.attr#preserveLegacyExternalStorage I haven't verified if it works as expected, but it seems like it's what you're looking for. Good luck! |
This is not related to the OP request whatsoever. The OP is talking about the webview's data storage containers, which are bound to the document's origin. Cordova-android@9 and earlier used a file:// scheme so the document's origin is
We had a discussion on how to deal with the origin changes in this mailing list thread In a short summary, the Apache volunteer team decided not to handle data migration ourselves and decided it is up to the community users to develop a plugin to migrate the data themselves. If you aren't ready to migrate data, then the I'm closing this request as it was already decided that Apache won't take responsibility of migrating data. You won't be able to take this plugin as is for data migration, but you can learn a bit how to migrate local storage data by looking at the plugin sources. The two major differences is that modern chrome webviews doesn't use SQLite databases anymore, it uses LevelDB, and xwalk directories are only for users using crosswalk. |
Thanks for clearing that up @breautek I will keep an eye out for a plugin and have a proper read through that email thread as there seem to be some discussions on migrations strategy in there too. I might also look at migrating to something like https://github.com/TheCocoaProject/cordova-plugin-nativestorage and then enable WebViewAssetLoader once I'm happy enough users are migrated. Thanks for your help! |
Yah, personally I would move away from relying on browser storage, and part of your migration strategy might be using that native storage plugin. In my apps, I've migrated to either using flat files using cordova-plugin-file, or SQLite using an sqlite plugin -- depending on the complexity of the data being stored in the app. |
It's fairly simple, just settings mainly, so SQLite is definitely an option, especially as the owner of the nativestorage plugin has said he doesn't have time to actively maintain it. |
If the AndroidInsecureFileModeEnabled attribute is set to true, will the play store still accept the application updates? |
For the foreseeable future, I cannot see why not. By default, the webview always used local file paths and everyone running cordova-android@9 and earlier would be using the local filepaths as well. Google hasn't gave any signal that it will start rejecting these apps because they are using file:// based paths. They are however recommend people to start using the web asset loader, which is what cordova-android@10 implements and uses by default. |
Feature Request
Motivation Behind Feature
As per the discussion on this issue: #1137 (comment) localStorage data will no longer be accessible when the origin changes from file:// to https://localhost
Feature Description
The discussion above suggests incorporating migration of localStorage/cookies/etc from file:// to https://localhost into the core of the android platform.
I was wondering if this was in the plan, or if anyone can suggest another way of achieving this now?
The text was updated successfully, but these errors were encountered: