olegst
olegst

Reputation: 1267

How to run a service after factory reset or on first boot?

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

Answers (2)

Racer
Racer

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

Melih Akalan
Melih Akalan

Reputation: 61

Yes if you compile and run a custom Android OS for yourself.

Upvotes: 1

Related Questions