• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How to programmatically detect if factory reset has been done

  • Thread starter Thread starter cjfhsfkjhdsfdkg1703
  • Start date Start date
C

cjfhsfkjhdsfdkg1703

Guest
I have my own system application on phone. I want my application to detect if factory reset has occurred.
Is there any way android application can understand, if factory reset has been done.
 
Yes I agree with @Dannydet. Proforming a factory reset wipes all user data and that woulld inclued your app. Even if it was reinstalled it would have no prior data to be able to determine that information.
Perhaps if it were a pre-installed systems app but not for a user app. :(
 
I think the developers the hang out here could help with this. Sign up and post your question in the App Dev area.

I'm not an Android Developer, but I've done some programming in the past. I would think that if your apps was able to phone home any usage data on a device, and identify it by meid or other unique id, then upon re-installation (or boot following FDR since you said it was a system app) you could detect an absense of data relative to what you have stored in the central database and assume that there was either a FDR or they cleared data from the app.

Again, I'm talking theoretical, the devs here may be able to help you nail down true feasibility and methods of implementation.
 
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? :)
 
After think about it a bit longer, perhaps is you app was connected to an online service then it might be able to determine FR once the app was reinstalled.
 
My application is system application, so after factory reset application will be still present i feel. Is there any way my system application notification/information saying factory reset is sucess happened?
 
If your app survives FRs, have your app try the following (assuming it runs after the FR)..

1. App creates a file in the internal storage root folder.
2. App periodically monitors its presence.
3. When the file disappears, we have an FR.
4. Thank me very much.
5. All done...
 
Back
Top Bottom