DCheeseman wrote:
> While debugging one of my apps (one that sits in the background and
> logs accelerometer data), I noticed that it would randomly and without
> any prompt reset itself.  It would be running it's normal timer task
> and suddenly it would stop, the create function would be called and
> any running task would halt. 

Do not use TimerTask with an unbound Service. Use AlarmManager, so the
Service does not have to remain in memory all the time.

http://github.com/commonsguy/cw-advandroid/tree/master/SystemServices/Alarm/

> I have a
> wake lock and I thought that was enough to keep it from getting kicked
> out of memory.

WakeLocks have nothing to do with keeping services in memory. In
general, you don't *want* to keep services in memory any more than is
necessary.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 2.0 Available!

-- 
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