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

102. Implement Intent Service and Alarm Manager

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 how to fire an IntentService to execute regularly using an AlarmManager. In the first step, create an IntentService using Android Studio’s standard template and ensure it is added to the AndroidManifest.xml with an android:exported attribute set to false indicating that other applications cannot start this Service. Override the onHandleIntent which runs in a background thread where you can execute the logic corresponding to BucketDrops. Get an object of AlarmManager using the getSystemService method. Create a PendingIntent using the getService method to start the IntentService at some point in the future. Use the setInexactRepeating method to ensure that the alarm manager runs the code since the time the device is awake every x minutes or so.

Course Cirriculum