wobsoriano
wobsoriano

Reputation: 13434

How can I persist local-storage items from a Cordova application to phone?

So I've developed an app that saves contacts via local-storage. My problem is every time I update the app or uninstall it, the item is deleted too.

I see that using SQLite storage will do the same also.

Is there a way to persist it to the phone so the data can be saved whenever I update the app? Thanks.

Upvotes: 0

Views: 714

Answers (2)

DaveAlden
DaveAlden

Reputation: 30356

If you want these contacts to remain only available in your app (i.e not add them to the global Contacts list), and if there's not too much data (less than 1Mb on iOS but unlimited on Android), then you could use cordova-plugin-cloud-settings which backs up data in the cloud (Android auto-backup / iCloud).

This ensures the data persists between app uninstall/re-install.

Upvotes: 2

Martin Zeitler
Martin Zeitler

Reputation: 76639

you'd have migrate from window.localStorage to SQLite or Preferences

... or even to Contacts, because we are talking about contacts here.

Upvotes: 1

Related Questions