On Sat, Jan 14, 2012 at 12:43 PM, Dirk <b...@informatik.uni-hamburg.de> wrote:
> I am writing a service which shall continuously log some sensor data
> over longer periods of time. For testing purposes the service shall
> log a static debug message once every second. Looking at the log file,
> after some time (usually 30min to several hours), the logging only
> takes place every 10 minutes, every half an hour or sometimes even
> only once an hour. When I connect the phone to my computer, the
> service starts logging every second again.

That is because the phone is falling asleep. Users like it when their
phone falls asleep, as this maximizes battery life.

> The service is started once the device completed its boot process (or
> once the corresponding activity is launched) using:
>
> Intent serviceIntent = new Intent(getApplicationContext(),
> TestService.class);
> startService(serviceIntent);

You do not need getApplicationContext() here. Please replace it with
the "this" object reference.

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

Android Training in NYC: http://marakana.com/training/android/

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to