From Newsgroup: comp.mobile.android
PSA:
How to perform an in-place replacement of an APK without losing data
I am testing how to lock down an app so it's never updated, and in
doing so, I needed to test changing the installer on some apps.
So this PSA below covers two different critically important concepts.
a. How to seamlessly update an app to a newer or older version
b. At the same time how to seamlessly change the installer field
c. Which is intended to break google play store updating of that app
If you have the Aurora Google Store replacement client, you can run this.
1. Find a link to the latest Aurora Google Play Store replacement
<
https://github.com/AuroraOSS/AuroraStore>
<
https://auroraoss.com/files>
<
https://gitlab.com/AuroraOSS/AuroraStore>
<
https://f-droid.org/packages/com.aurora.store/>
2. Download the latest APK
wget
https://auroraoss.com/downloads/AuroraStore/Release/AuroraStore-4.8.4.apk
=> 2026-07-31 (7.23 MB/s) - 'AuroraStore-4.8.4.apk' saved
3. Find the official name of the package already installed on Android
adb shell pm list packages | findstr aurora
=> package:com.aurora.store
=> package:com.aurora.adroid
4. Check what the current "installer" is set to
adb shell dumpsys package com.aurora.store | findstr installer
=> returned no installerPackageName line
5. Check what the current "version" fields are set to
adb shell dumpsys package com.aurora.store | findstr version
=> versionCode=76 minSdk=23 targetSdk=37
=> versionName=4.8.1
6. Run both a seamless replacement & change of the installer setting
adb install -r -d -i null AuroraStore-4.8.4.apk
=> Performing Streamed Install
=> Success
(r=replace but keep data, d=allow downgrade, i=set installer name)
Now that the old app was removed from /data/app/com.aurora.store-*/base.apk
And replaced with the new app of the same name...
7. Check the newly installed version is as desired
adb shell dumpsys package com.aurora.store | findstr version
=> versionCode=76 minSdk=23 targetSdk=37
=> versionName=4.8.4
8. Check that the installer was set as desired
adb shell dumpsys package com.aurora.store | findstr installer
=> installerPackageName=null
Note that another way to accomplish (almost) the same results would be:
adb uninstall -k com.aurora.store
adb install -i null AuroraStore-4.8.4.apk
The difference is that in-place replacement (install -r) is seamless.
The delete-and-reinstall (uninstall -k + install) acts like a new instance.
a. the app will behave as if it were newly installed
b. hence, the shortcut will be removed from its homescreen location
c. although data is preserved but cache may be removed
d. the app identity is removed & added (e.g., launcher-icon placement)
e. permissions may need to be re-granted
f. and some runtime state is lost (e.g., notification channels)
The app is removed, then installed again, and Android reattaches the
preserved data but the app behaves like a fresh install .
In both cases, persistent what's in /data/data/com.aurora.store/ remained
a. User settings
b. Preferences
c. Login/session data
d. Account tokens
e. Configuration files
f. Databases
g. Cached information
h. Customizations
i. SharedPreferences XML files
j. Internal app state files
k. App-generated JSON/YAML/XML config files
l. App-generated metadata
m. App-specific logs
n. App-specific cache stored inside /data/data
o. Any other persistent files Aurora Store writes
The key difference in results is in installation behavior:
install -r = seamless upgrade
uninstall -k + install = fresh install with old data reattached
But no persistent data is lost in either method.
--
Posted out of the goodness of my heart to help others & to learn from them.
--- Synchronet 3.22a-Linux NewsLink 1.2