Reputation: 1267
I need to perform certain operations when the phone is "clean", that is on first boot or after the factory reset. What are the possible ways to achieve this? How Android itself determines whether it's the first boot?
Can I use the same mechanism?
Upvotes: 2
Views: 240
Reputation: 152
You can use the Broadcast receiver to listen to when the device is booted.
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
After a factory reset, all the apps will be removed except the system apps. So there is no way you can run without your app.
If you really wanna achieve that you need to modify the Android OS to add your app as a system app and flash the device with the modified OS.
Upvotes: 1