I want my application to detect if factory reset has occurred.
Occurred? Maybe, maybe not.
Initiated? Yes, probably.
I don't develop Android apps, and it's been years since I had to quit working--as a programmer and sysadmin on Linux.
From my 35 years of using *nix, I feel
strongly that what you're asking is theoretically possible--but I can't translate that to an Android app.
At its most basic, it comes down to:
- having the app installed and running before a reset can ever be attempted
- making sure the app cannot be disabled or removed
- 'trapping' the user action that triggers a factory reset
- once that trigger is detected, phoning home or...?
As you can see, there are many variables, some of which could cause it to fail. For example,
how would it phone home? What if the user has already turned off all forms of communication?
Okay, then, what other options are there? A factory reset wipes
user data, leaving the system/OS partition alone, right? Since your app is a system app, trapping the reset trigger could, instead of phoning home right away, create a log file on the system partition. After the reset--and assuming that your app is reinstalled--it could detect the log and then phone home.
If my logic is flawed--which is very possible!--I'd appreciate having pointed out how and why. Live and learn, you know?