I tried this wakefull example:https://github.com/commonsguy/cw-omnibus/tree/master/AlarmManager/Wakeful
But I have a few questions.
Do I need <action android:name="android.intent.action.BOOT_COMPLETED" />
? because the intent is always null, as I tested.
And inScheduledService is:
@Override
protected void doWakefulWork(Intent intent) {
Log.d(getClass().getSimpleName(), "I ran!");
}
But this method is never fired.
In WakefulintentService there is this method, which is also never fired:
@Override
final protected void onHandleIntent(Intent intent) {
try {
doWakefulWork(intent);
} finally {
PowerManager.WakeLock lock = getLock(this.getApplicationContext());
if (lock.isHeld()) {
lock.release();
}
}
}
What to change, so that i will get I ran
as output?
Only if you wish to set up your alarms again after a reboot. By default, alarms are wiped out when the device reboots.
Yes, it is. You can tell this by running the project.
Yes, it is. You can tell this by running the project.
For example, here is the output of a run I just did now: