0

I would like to delete the cache and all details of previous versions of an application programmatically when I am installing a new version of an application. How do you do this?

1 Answers1

3

First determine the current application is old version, then delete it via:

Uri packageURI = Uri.parse("package: your.application.package");
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
startActivity(uninstallIntent);
NullPointer
  • 1,972
  • 3
  • 22
  • 40