> After doing some more testing, I observed that its still happening that
> the background service sometime runs and sometime doesn't run.

You might consider replacing:

long firstTime = SystemClock.elapsedRealtime();

with:

long firstTime = SystemClock.elapsedRealtime() + 10 *1000;

(where 10 *1000 is the time you're using between clock pulses).

In your current code, it may be that firstTime is technically in the past
by the time AlarmManager tries using the value, due to other processing in
the emulator, or just the clock ticking forward in between statements.
Setting the first time to be in the near future should resolve this
problem.

If that doesn't help, could you clarify what you mean when you say
"sometime runs and sometime doesn't run"? For example, I see various Log
statements in your code. When you don't get the expected behavior, what is
the log telling you?

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ -- Available Now!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to