Create your account

Already have an account? Login here

Note: By joining, you will receive periodic emails from Coursetro. You can unsubscribe from these emails.

Create account

105. Boot Receiver

Design + Code an Android App from Scratch

Woah, wait a second..

Scrounge up some loose change to become a pro member, or login to your account to view this lesson.

Alright, join now. Or login to your account if you're already a pro member.

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.

Course Cirriculum