Design + Code an Android App from Scratch
This video shows you how to implement a Broadcast Receiver that is triggered when the system reboots. The idea behind this is to ensure that we want to run our Service periodically to check which tasks have only 10% time left even if the device is restarted. Create a Broadcast Receiver using the template Android Studio provides and ensure that it is enabled meaning capable of handling Intents and exported which means external applications such as the Android system can trigger it. Override the onReceive method where we schedule the AlarmManager once again to fire the Service periodically using the setInexactRepeating method. We add the ACTION_BOOT_COMPLETED to the IntentFilter of this Broadcast Receiver to indicate that it wants to be notified after the system has finished booting. We need to add the permission RECEIVE_BOOT_COMPLETED to receive this Broadcast.