Search code examples
androideclipsecordovaadb

How can I clear my app's localStorage on my Android emulator each time I install it?


I want to clear localStorage for my app each time I install it from Eclipse to simulate installing the app for the first time.

How can I do this?

Thanks!

I answered this, specifically for Android, here - Programmatically clear PhoneGap/Cordova app's cache on Android to simulate a fresh install?


Solution

  • There are no hooks in Eclipse, but you could probably do this with Ant. You can add a task that executes the clear command (pm clear my.package) before uploading the app. If pm clear does not work, you can write a small script and start it on the device before uploading the app

    There is also the Android run configuration's 'Wipe user data' checkbox, but it only works on emulator startup.