Thanks for the replys, Looking into it the partial wake lock should be my solution, but it isnt implementing well. I keep getting a runtime error on acquire(). my code looks like: PM = (PowerManager) getSystemService(Context.POWER_SERVICE); WL= PM.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Wakelock"); WL.acquire(); I put this in the onStartCommand(), is that incorrect? Should only acquire the wakelock when the screen turns off?
Thank you On Wed, Jul 20, 2011 at 3:59 AM, Filip Havlicek <havlicek.fi...@gmail.com>wrote: > Acquire a partial wake lock, that should help. > > > 2011/7/20 Jan Nielsen <j...@air-port.dk> > >> The common ways to sleep in java, only counts cpu time on the Android >> platform. >> So a Thread.sleep(60 * 1000); may become 5 or 10 minutes if the phone >> is in standby, since it only counts when the cpu is awake. >> >> afaik you need to use AlarmManager to get called when the phone is in >> standby. >> Even a handler postDelayed wont work, as that is also wake time. >> >> On 19 Jul., 23:20, Chris Conry <cjco...@gmail.com> wrote: >> > I'm trying to build an app that logs sensor data(using a service), and >> > stores it into an SQLite database. My problem is that it stops logging >> when >> > the screen is off. It works perfectly fine when the screen is on, but >> when i >> > turn the screen off the data doesn't start logging until I turn the >> screen >> > on. The process isn't being killed, because it works when the screen >> comes >> > back on. >> > >> > I've tried implementing it as a Thread. I think that wont work because >> it >> > needs a context for the database. And I read that using >> "startForeground", >> > but it didn't change. >> > >> > Any Suggestions? Can anyone help? >> > >> > Thank you >> >> -- >> 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 >> > > -- > 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 > -- 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