Hi,

The issue got resolved after PARTIAL_WAKE_LOCK is acquired.

Regards,
Manoj

On Jan 2, 1:32 pm, mnj <[email protected]> wrote:
> Hi,
>
> I need to run a service at periodic intervals even after phones goes
> idle (i.e CPU turn off).
> For this I'm scheduling an alarm using Alarm Manager using setRepeating
> () API and RTC_WAKEUP flag
>
> But its not working as expected. Only when phone screen is on the
> alarm is getting scheduled and service is getting executed. But when
> the screen goes off, the service is not getting executed.
>
> code
> ==================================================================
> Intent i = new Intent();
> i.setClassName( "com.mydomain.AlarmSample",
> "com.mydomain.AlarmSample.myservice" );
> PendingIntent mAlarmSender = PendingIntent.getService(battMonitor.this,
> 0, i, 0);
>
> AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
> am.setRepeating(AlarmManager.RTC_WAKEUP,
>                         firstTime, delay*1000, mAlarmSender);
> ======================================================================
>
> Do I need ot use PARTIAL_WAKE_LOCK to keep the phone from getting
> turned off.. If so where should I acquire the lock. Is there any
> sample code for WAKE_LOCK.
>
> Regards,
> Manoj
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to