i want to check how the service feature set in android works. to check it, i have a controller class that will start the service. in the service i have a handler that executes a function every minute.the function plays the sound. everything works well when the screen is on but after the screen goes dark(off), the sound is heard about 2-3 times (2-3 minutes) and then it stops... any idea why? and how can i make it (execute the sound function)work every minute?
Asked
Active
Viewed 1,777 times
1 Answers
1
When the phone goes into sleep mode, so does the cpu. Some recievers may wake the phone up causing your sounds to be heard. Take a look into PowerManager and try to wake your phone(and cpu) up when you want to hear the sound.

ninjasense
- 13,756
- 19
- 75
- 92
-
@ninjasense...thank you for that..but isn't using PowerManager restricted for general developers. please let me know if you have used it without having to root the phone or compile own firmware – i_raqz Mar 12 '11 at 08:10
-
@raqz - No it is not, you will have to add a permission to your android manifest though...http://developer.android.com/reference/android/Manifest.permission.html – ninjasense Mar 12 '11 at 08:19
-
@ninjasense..thank you.it worked. but now i am facing a new issue, will create a new question in SO for the benefit of others – i_raqz Mar 13 '11 at 00:41
-
@ninjasense..kindly have a look at this question http://stackoverflow.com/questions/5286947/wake-locks-android-service-recurring – i_raqz Mar 13 '11 at 02:08