title: Programmatically clear PhoneGap/Cordova app's cache on Android to simulate a fresh install?
body: <p>This is related to my previous question of '<a href="https://stackoverflow.com/questions/11142069/how-can-i-clear-my-apps-localstorage-on-my-android-emulator-each-time-i-install">How can I clear my app's localStorage on my Android emulator each time I install it?</a>'.</p>
  
  <p>It also builds on '<a href="https://stackoverflow.com/questions/8474444/how-can-i-clear-the-android-app-cache">How can I clear the Android app cache?</a>' and '<a href="https://stackoverflow.com/questions/4856955/how-to-programatically-clear-application-data">How to programatically clear application data?</a>'.</p>
  
  <p>None of the above questions give a straightforward answer that is applicable to Android PhoneGap/Cordova applications. <a href="http://www.hrupin.com/2011/11/how-to-clear-user-data-in-your-android-application-programmatically" rel="nofollow noreferrer">This blog post</a> by <a href="https://stackoverflow.com/users/709778/ihrupin">Igor Hrupin</a> covers the situation in the context of a <strong><em>native</em></strong> Android app, so this question extends that to cover Cordova.</p>
  
  <p>I will post an answer myself, but I am a total Java noob, so please edit to improve.</p>