Why in the Demo API AlarmService_Service.java, it says "just sleep for 30 seconds" instead of 15 seconds?

I just looked at the AlarmService sample in the Android API Demo (API 8).

When the AlarmManager in the AlarmService.java file uses the setRepeating () method to schedule an alarm, the service will create a new thread in the AlarmService_Service.java file.

My question is:

In the run () method of the mTask Runnable object, why does it say "we'll sleep 30 seconds"? I understand: the thread starts and it waits / sleeps for 15 seconds (not 30 seconds), then this thread will be stopped by calling the stopSelf () method. That way he will sleep 15 seconds instead of 30, right? Did I miss something?

Any clues?

Thanks in advance:)

0
source share
1 answer

People make mistakes. Despite my little experience with Android Development, it seems like a mistake.

Of course, the real way to find out is to use a stopwatch while the code is running.

+2
source

All Articles