Code:
Intent intent = new Intent(context.getApplicationContext(), UpdateWidgetService.class);
PendingIntent service = PendingIntent.getService(context,
MyCode,
intent,
PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
am.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime(), iInterval, service);
The service logs its activity. To do the test, I push the power to put the Android device to sleep. I wake up the device a few hours later to check the log and find the service is run according to the interval during the sleep. My understanding is that ELAPSED_REALTIME does not wake up the device to run. In other words, ELAPSED_REALTIME in this case behaves like ELAPSED_REALTIME_WAKEUP that wakes up the device to run a task.
Could anyone shed some light on this? Is there something wrong with the code or my test?