Android-RateThisApp icon indicating copy to clipboard operation
Android-RateThisApp copied to clipboard

KEY_INSTALL_DATE pref not cleared on uninstall

Open oseparovic opened this issue 8 years ago • 1 comments

This line in onStart returns the same date no matter how many times I uninstall the app.

    mInstallDate = new Date(pref.getLong(KEY_INSTALL_DATE, 0));

The result is that on my test device I cannot properly test the functionality of RateThisApp because the prompt is always triggered on a fresh install. According to this SO post Android automatically backs up preferences to your account since SDK 21: http://stackoverflow.com/questions/15873066/how-to-remove-shared-preference-while-application-uninstall-in-android

However I already have android:allowBackup="false" and am still experiencing this issue. Does anyone have any suggestions?

oseparovic avatar Jan 30 '17 19:01 oseparovic

Ah I found the reason for this. It looks like onStart directly pulls the install date from the package manager via storeInstallDate. Is this necessary? This will force persistent RateThisApp preferences between installs which some developers might want to avoid.

Edit: never mind it looks like this is somehow related to Android Studio. When I manually uninstalled the apk via adb commands and then reinstalled via adb the install date was properly reset. I guess Android Studio somehow persists preferences when installing debug builds? Any clarifications on this?

oseparovic avatar Jan 30 '17 19:01 oseparovic