Clear localStorage when re-installing app on Phonegap

Is there a way that I can force local storage to be cleared when a phonegap app is reinstalled ?

You’ll have to built that into your app. You could keep a value like localStorage.version and wipe it depending on the value of version.

My email reply was truncated (again) so here’s the full post…

There used to be easy ways to do this but alas those have gone away…

Here’s one solution: in your header (or common .js file) set a build number. On startup, compare that build number against local storage. If they’re the same then do nothing. If local storage has NOT been set then set whatever defaults need setting. If the app build number > local storage you can do whatever…

This method really sucks because you have to remember to update the build number.

Easier to hide a function to reset… Maybe a tap+hold on a specific header (i.e settings page).

Also let me caution you, local storage is NOT guaranteed to be set. iOS is notorious for deleting local storage when phone storage runs low. If you’re storing login info in local storage a user can be forced to login every time they use your app!