How can I clean my localStorage application on my Android emulator every time I install it?

I want to clear localStorage for my application every time I install it from Eclipse in order to simulate installing the application for the first time.

How can i do this?

Thanks!

I answered this, specifically for Android, here - Programmatically clear the cache of PhoneGap / Cordova application on Android to simulate a new installation?

+2
source share
4 answers

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

There is also a β€œClear user data” checkbox for Android, but it only works when the emulator starts.

+3
source

I use the Chrome inspector (chrome: // inspect) which shows the connected Android device very well. From there, you can simply click "Resources" to access and modify localStorage

+1
source

I'm not sure if you want it programmatically or through ADB - in any case, this should solve it

How to programmatically clear application data

0
source

For testing purposes, you can reset the quick local storage statement:

 localStorage = "" 

Be sure to remove this before release.

0
source

All Articles