Making an Android app survive a factory reset

how do i install an app that makes it factory reset persistent?

It has to be baked into the rom

can you please explain?

When you factory reset, everything is restored to the original state in the system image. To make an app persist (apps usually aren’t in the system partition) you’ll have to make it a system app baked into the ROM itself.

Basically you’ll have to be sure you can flash modified partitions, (unlocked bootloader, vbmeta etc), unpack the super and edit the system.img and adding the desired app and other files depending on your device, repack and flash

and then after a flash it won’t have to install?

what about if i use adb shell su and add an apk i do not think that it installs automaticly

you can also use root to place an apk in the system partition and it will survive a factory reset

but how do you install it , by using root you are just placing a file it does not install it.

if you place the file in the system partition and then reboot the phone automaticall detects the new apk in system and installs it

tell me if you need help placing a certain apk in system

make sure you device is - bootloader unlcocked and you have correct vbmeta (empty ones work) and you have proper root accsess

On all devices? I’m pretty sure some require you to make changes to some config files before the phone recognizes them. Not really sure though.

depends on what permissions it wants, sometimes you need to add a config file to whitelist it. usually only if its asking for privileged permissions, most apps don’t

if you place the app in /system/app usually that all you need.

how do i remove an app that survived factory reset

Root?
Delete it from the partitions.
Which app?

Easiest way just use a root app uninstaller

Link2SD.apk (3.8 MB)