How do I migrate LocalStorage to a different webview? (e.g. Canvas+ to elsewhere)

0 favourites
  • 1 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • I'd like to figure out how to migrate my app from Canvas+ to WkWebView and then write a tutorial for the community.

    Has anyone ever migrated their localstorage data to another type of webview? If I just upgrade my Canvas+ app to Webview, localstorage object data is not preserved because of the switch from storage space from Canvas+ to WebView. I have a workaround on this for Android but not for iOS. I need a way around wiping out all of my user's data in order to get to a supported platform.

    I've looked at 3 solutions:

    1. The cordova-plugin-nativestorage plugin looks like a great method, but I can't get it to read/write. Reads come up with "0". I may post a separate thread on this.

    2. Cloud storage or Firebase would be options, but Canvas+ doesn't support them due to limited DOM access.

    3. I can spawn a Webview instance from Canvas+ using Cocoon.App.Webview and pass localstorage.setitem commands for the userdata keys. if I then Upgrade the app to Webview and try localstorage.getitem (via browser.ExecJS), I see the data I created in Canvas+. So, this works! Buuuut... only for an Android. iOS Webview (UI or WK, PhoneGap or Cocoon) doesn't see anything created in localstorage before upgrade.

    Any interesting thoughts on this?

    Thanks!

    -Steve

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)