Design + Code an Android App from Scratch
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.