0

I am developing an app using cordova (currently only releasing on Android) and I am struggling with storage options.

I am currently using Local Storage which seems to work well, however all data/values are wiped if the user uninstalls and reinstalls the app. I was wondering if there is a plugin or some way to permanently store data on Android even if the user uninstalls the app?

The reason I would like this is to allow the user to keep the coins they have earned/purchased if they were to remove the app and then get it back at a later date? I also have an 'ad free' IAP and I am currently storing a value in Local Storage when the user purchases this so don't want the ads to come back if they uninstall/reinstall.

If this is not possible is there an alternative way to recognise if the user has purchased the Ad Free IAP so they will always have no ads?

Callum
  • 3
  • 1
  • 2

3 Answers3

0

You can save user data online. Check Firebase Fetch the data from the server when needed.

Or you can also write it on a file and save it on local storage (not a good idea for most of the time)

shb
  • 5,957
  • 2
  • 15
  • 32
0

This is terrible practice. You should always keep server side the amount of earned/purchased items then fetch them as you start the app. It wouldn't be too hard to download and rebuild your app in debug mode then change the local storage.

Eric
  • 9,870
  • 14
  • 66
  • 102
0

You could use cordova-plugin-cloud-settings to persist key/value data between installs / across same-platform devices.

DaveAlden
  • 30,083
  • 11
  • 93
  • 155
  • Thanks a lot, looks like a promising solution. Do you know about often the settings are backed up to the cloud? For example, if someone downloaded the app, played it for 5-10 minutes, uninstalled it and then reinstalled it a few days later would their settings be saved? – Callum Sep 13 '18 at 10:11
  • Backups are not that frequent (approx daily) and when certain conditions are met, depending on platform and version: [iCloud (iOS)](https://discussions.apple.com/thread/3376384#31527808022), [Auto Backup (Android 6+)](http://androiddoc.qiniudn.com/training/backup/autosyncapi.html), [Backup API (Android <=5)](https://stackoverflow.com/a/27751837/777265) – DaveAlden Sep 13 '18 at 10:28