Does AlarmManager hold the CPU lock all the time?
No.
Then what will happen in following situation?
Your PendingIntent
will be invoked a 10 minutes after you place the call to setRepeating()
(except on API Level 19+, in which case repeating alarms are inexact, and so the precise timing is indeterminate).
AlarmManager holds CPU for next 10 seconds.
No. First, your alarm is for 10 minutes, not 10 seconds. Second, the CPU will be allowed to go into a sleep mode. A different circuit will arrange to wake it back up at the appropriate time.
Is there any difference between the following pseudo codes
The first will keep the CPU powered on for 10 seconds.
The second will allow the CPU to go into a sleep mode, waking up again after ~10 minutes (where the "~" goes back to my comment about API Level 19+).