Search code examples
cordovaxamarinxamarin.iosxamarin.androidcordova-plugins

Migrating local storage from Cordova to Xamarin App


We are planning on moving our app (iOS, Android, WP) from Cordova/Ionic to Xamarin.

The basic plan is to rebuild everything in Xamarin, keep the same appids in the stores and just provide the new app as "an update".

Now the tricky part. Today our users are signed in via a token stored on the device using window.localStorage.setItemin Cordova.

How do I get access to this data in Xamarin? Is it stored somewhere in a file I can look for at startup and do a conversion? What is the format? Is it plaintext or encrypted?

Any help would be highly appreciated. Thanks!


Solution

  • So after some more research I figured out that localStorage in Cordova is not persistent at all.

    For more info look at these:

    So as I needed to fix this strange bug anyway in my Cordova app, I decided to "move" the token to disk in Cordova by using the Cordova File Plugin and now the content of localStorage is "just a file on disk".

    By doing this, I effectively answered my own question on how to "migrate data from localStorage" ;)

    I hope this may help someone in the same situation.