2

Anyone knows how to force uninstall application before update it. If i upload new app in market the old one is rewrited with new app but some static values will exist from old version.

Is in manifest.xml any option to force uninstall application before update it when you are using google play.

senzacionale
  • 20,448
  • 67
  • 204
  • 316

3 Answers3

3

You can't command android to to a clean reinstall of your app for updates. There is no API support for this.

However, you can control and overwrite any files or values you may have put in the previous version yourself manually by putting a block of code that runs once every version to do the clean up..

Raghav Sood
  • 81,899
  • 22
  • 187
  • 195
0

You could always do the cleaning by yourself when new version appears. Just keep actual version of pp in shared prefs and check it on app start (won't impact on performance), and if version in prefs differs from version in manifest (I assume that you keep versioning app in Manifest, so you can easily check installed version dynamically) you can do some background cleaning.

Kostek
  • 147
  • 13
0

As far as I know, you can't do that.

But there is an easy way to check if you are in an update or not, using SharedPreferences and a new variable:

    SharedPreferences sharedPreferences = mContext.getSharedPreferences(PREFERENCES, Context.MODE_PRIVATE);
    if ((sharedPreferences.getInt(APP_VERSION, 1) == 1) {
        // you are updating
        // set APP_VERSION = 2 and your new values
    } else {
        // you are not updating
    }
Jon
  • 9,156
  • 9
  • 56
  • 73
thelawnmowerman
  • 11,956
  • 2
  • 23
  • 36