Re: [android-developers] Re: Service Being paused on screen off.
The issue is that the accelerometer sensor is turning off. So the listener will not detect any changes while it is off. Your CPU isnt sleeping while the screen is off, maybe slowing down to save power, but it will not completely shut off. So a service running should still be running. The best work around is on a kernel level, not really an app level. On Thu, Jan 19, 2012 at 3:38 PM, Kristopher Micinski krismicin...@gmail.com wrote: I didn't see the original thread you're responding to, so what's your question? As in you want your service to stop using resources when the screen is off, or the opposite. In one of those situations you can hold a wake lock to keep the cpu on, but not the screen, I believe. kris On Thu, Jan 19, 2012 at 11:18 AM, crennie cmren...@gmail.com wrote: I found the same thing. The accelerometer still fires when the screen is off but connected to USB and logcat. There might be a work around here somewhere. I'm just not savy enough to figure it out. Andyone else care to hack this? -- 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
Re: [android-developers] Re: Service Being paused on screen off.
I found the same thing. The accelerometer still fires when the screen is off but connected to USB and logcat. There might be a work around here somewhere. I'm just not savy enough to figure it out. Andyone else care to hack this? -- 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
Re: [android-developers] Re: Service Being paused on screen off.
I didn't see the original thread you're responding to, so what's your question? As in you want your service to stop using resources when the screen is off, or the opposite. In one of those situations you can hold a wake lock to keep the cpu on, but not the screen, I believe. kris On Thu, Jan 19, 2012 at 11:18 AM, crennie cmren...@gmail.com wrote: I found the same thing. The accelerometer still fires when the screen is off but connected to USB and logcat. There might be a work around here somewhere. I'm just not savy enough to figure it out. Andyone else care to hack this? -- 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
Re: [android-developers] Re: Service Being paused on screen off.
According these, I think some cases will you come across : open sensor 1: and then screen off, phone will close sensor. if screen on, sensor will be lunched, you can log the sensor go on. It's not affect logging result. 2: if not close sensor, I think it should be used AlarmManager to log because that it can wake up CPU when asleep status. In here I want to clarify different about Thread.sleep and AlarmManager When I create a app using thread sleep to run something every 20s, run that app and then let screen off in device not connect any usb line , about over 20m, I connect the usb and logcat , I find the thread still run, cpu not sleep, it's amazing. Could you give some comments about that ? On Thu, Jul 21, 2011 at 3:25 AM, Dianne Hackborn hack...@android.comwrote: The only two types of wakelocks are partial and full. A full wakelock will keep the screen from automatically turning off, and the screen being on will definitely mean the sensors are running. Once the user presses the power button and turns the screen off, though, you are in no better a state than holding a partial wake lock. On Wed, Jul 20, 2011 at 11:40 AM, Filip Havlicek havlicek.fi...@gmail.com wrote: If you are trying to develop a market application, I think there is no workaround. If you just want to experiment with the accelerometer data, you can try different types of wakelock as Mark suggested, some of them might work. Or just keep the device awake while you do the experiments (although you might need to recharge the device every few hours). It might be possible to do something about it on the OS level if you root your devices, although that would need a bit more digging. Best regards, Filip Havlicek 2011/7/20 Chris Conry cjco...@gmail.com Thanks for the answers, Makes sense now, I am using the myTouch 4g and LG ally, sadly both of them I guess turn off their sensors. Its good to hear that the Nexus and some 2.3 device keep it on and hopefully other manufacturers adopt this. I guess i'm going to try and find a work around. Any suggestions? Thank you On Wed, Jul 20, 2011 at 12:42 PM, Filip Havlicek havlicek.fi...@gmail.com wrote: Partial wake lock works just fine with accelerometer sensor on Nexus One 2.2 (tested this for over than 6 months as a part of my research), although this might not be the case for different combination of device and OS version. 2011/7/20 Dianne Hackborn hack...@android.com Prior to 2.3 the sensors were turned off when the screen went off in order to reduce battery use. This was changed on 2.3, though it's possible we are actually going to end up regretting that change. :p Also even as of 2.3, I wouldn't be surprised if some device's drivers are still turning off the sensor hardware as part of their power management when the screen goes off. On Wed, Jul 20, 2011 at 8:53 AM, Chris Conry cjco...@gmail.comwrote: And your guess was completely correct. Thank you. The problem is still happening, as soon as I hit the power button the data stops logging. Is there something else im missing about wakelock? On Wed, Jul 20, 2011 at 11:26 AM, Mark Murphy mmur...@commonsware.com wrote: Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and look at the stack trace associated with your runtime error. My guess is that you do not hold the WAKE_LOCK permission. On Wed, Jul 20, 2011 at 11:21 AM, Chris Conry cjco...@gmail.com wrote: 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.
[android-developers] Re: Service Being paused on screen off.
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
Re: [android-developers] Re: Service Being paused on screen off.
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
Re: [android-developers] Re: Service Being paused on screen off.
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.comwrote: 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
Re: [android-developers] Re: Service Being paused on screen off.
Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and look at the stack trace associated with your runtime error. My guess is that you do not hold the WAKE_LOCK permission. On Wed, Jul 20, 2011 at 11:21 AM, Chris Conry cjco...@gmail.com wrote: 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 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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
Re: [android-developers] Re: Service Being paused on screen off.
And your guess was completely correct. Thank you. The problem is still happening, as soon as I hit the power button the data stops logging. Is there something else im missing about wakelock? On Wed, Jul 20, 2011 at 11:26 AM, Mark Murphy mmur...@commonsware.comwrote: Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and look at the stack trace associated with your runtime error. My guess is that you do not hold the WAKE_LOCK permission. On Wed, Jul 20, 2011 at 11:21 AM, Chris Conry cjco...@gmail.com wrote: 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 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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
Re: [android-developers] Re: Service Being paused on screen off.
On Wed, Jul 20, 2011 at 11:53 AM, Chris Conry cjco...@gmail.com wrote: And your guess was completely correct. Thank you. The problem is still happening, as soon as I hit the power button the data stops logging. Is there something else im missing about wakelock? Try a stronger WakeLock than PARTIAL_WAKE_LOCK. Please understand that the sensors were not designed for use by services. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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
Re: [android-developers] Re: Service Being paused on screen off.
Prior to 2.3 the sensors were turned off when the screen went off in order to reduce battery use. This was changed on 2.3, though it's possible we are actually going to end up regretting that change. :p Also even as of 2.3, I wouldn't be surprised if some device's drivers are still turning off the sensor hardware as part of their power management when the screen goes off. On Wed, Jul 20, 2011 at 8:53 AM, Chris Conry cjco...@gmail.com wrote: And your guess was completely correct. Thank you. The problem is still happening, as soon as I hit the power button the data stops logging. Is there something else im missing about wakelock? On Wed, Jul 20, 2011 at 11:26 AM, Mark Murphy mmur...@commonsware.comwrote: Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and look at the stack trace associated with your runtime error. My guess is that you do not hold the WAKE_LOCK permission. On Wed, Jul 20, 2011 at 11:21 AM, Chris Conry cjco...@gmail.com wrote: 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 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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 -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't
Re: [android-developers] Re: Service Being paused on screen off.
Partial wake lock works just fine with accelerometer sensor on Nexus One 2.2 (tested this for over than 6 months as a part of my research), although this might not be the case for different combination of device and OS version. 2011/7/20 Dianne Hackborn hack...@android.com Prior to 2.3 the sensors were turned off when the screen went off in order to reduce battery use. This was changed on 2.3, though it's possible we are actually going to end up regretting that change. :p Also even as of 2.3, I wouldn't be surprised if some device's drivers are still turning off the sensor hardware as part of their power management when the screen goes off. On Wed, Jul 20, 2011 at 8:53 AM, Chris Conry cjco...@gmail.com wrote: And your guess was completely correct. Thank you. The problem is still happening, as soon as I hit the power button the data stops logging. Is there something else im missing about wakelock? On Wed, Jul 20, 2011 at 11:26 AM, Mark Murphy mmur...@commonsware.comwrote: Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and look at the stack trace associated with your runtime error. My guess is that you do not hold the WAKE_LOCK permission. On Wed, Jul 20, 2011 at 11:21 AM, Chris Conry cjco...@gmail.com wrote: 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 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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
Re: [android-developers] Re: Service Being paused on screen off.
Thanks for the answers, Makes sense now, I am using the myTouch 4g and LG ally, sadly both of them I guess turn off their sensors. Its good to hear that the Nexus and some 2.3 device keep it on and hopefully other manufacturers adopt this. I guess i'm going to try and find a work around. Any suggestions? Thank you On Wed, Jul 20, 2011 at 12:42 PM, Filip Havlicek havlicek.fi...@gmail.comwrote: Partial wake lock works just fine with accelerometer sensor on Nexus One 2.2 (tested this for over than 6 months as a part of my research), although this might not be the case for different combination of device and OS version. 2011/7/20 Dianne Hackborn hack...@android.com Prior to 2.3 the sensors were turned off when the screen went off in order to reduce battery use. This was changed on 2.3, though it's possible we are actually going to end up regretting that change. :p Also even as of 2.3, I wouldn't be surprised if some device's drivers are still turning off the sensor hardware as part of their power management when the screen goes off. On Wed, Jul 20, 2011 at 8:53 AM, Chris Conry cjco...@gmail.com wrote: And your guess was completely correct. Thank you. The problem is still happening, as soon as I hit the power button the data stops logging. Is there something else im missing about wakelock? On Wed, Jul 20, 2011 at 11:26 AM, Mark Murphy mmur...@commonsware.comwrote: Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and look at the stack trace associated with your runtime error. My guess is that you do not hold the WAKE_LOCK permission. On Wed, Jul 20, 2011 at 11:21 AM, Chris Conry cjco...@gmail.com wrote: 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 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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
Re: [android-developers] Re: Service Being paused on screen off.
If you are trying to develop a market application, I think there is no workaround. If you just want to experiment with the accelerometer data, you can try different types of wakelock as Mark suggested, some of them might work. Or just keep the device awake while you do the experiments (although you might need to recharge the device every few hours). It might be possible to do something about it on the OS level if you root your devices, although that would need a bit more digging. Best regards, Filip Havlicek 2011/7/20 Chris Conry cjco...@gmail.com Thanks for the answers, Makes sense now, I am using the myTouch 4g and LG ally, sadly both of them I guess turn off their sensors. Its good to hear that the Nexus and some 2.3 device keep it on and hopefully other manufacturers adopt this. I guess i'm going to try and find a work around. Any suggestions? Thank you On Wed, Jul 20, 2011 at 12:42 PM, Filip Havlicek havlicek.fi...@gmail.com wrote: Partial wake lock works just fine with accelerometer sensor on Nexus One 2.2 (tested this for over than 6 months as a part of my research), although this might not be the case for different combination of device and OS version. 2011/7/20 Dianne Hackborn hack...@android.com Prior to 2.3 the sensors were turned off when the screen went off in order to reduce battery use. This was changed on 2.3, though it's possible we are actually going to end up regretting that change. :p Also even as of 2.3, I wouldn't be surprised if some device's drivers are still turning off the sensor hardware as part of their power management when the screen goes off. On Wed, Jul 20, 2011 at 8:53 AM, Chris Conry cjco...@gmail.com wrote: And your guess was completely correct. Thank you. The problem is still happening, as soon as I hit the power button the data stops logging. Is there something else im missing about wakelock? On Wed, Jul 20, 2011 at 11:26 AM, Mark Murphy mmur...@commonsware.comwrote: Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and look at the stack trace associated with your runtime error. My guess is that you do not hold the WAKE_LOCK permission. On Wed, Jul 20, 2011 at 11:21 AM, Chris Conry cjco...@gmail.com wrote: 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,
Re: [android-developers] Re: Service Being paused on screen off.
The only two types of wakelocks are partial and full. A full wakelock will keep the screen from automatically turning off, and the screen being on will definitely mean the sensors are running. Once the user presses the power button and turns the screen off, though, you are in no better a state than holding a partial wake lock. On Wed, Jul 20, 2011 at 11:40 AM, Filip Havlicek havlicek.fi...@gmail.comwrote: If you are trying to develop a market application, I think there is no workaround. If you just want to experiment with the accelerometer data, you can try different types of wakelock as Mark suggested, some of them might work. Or just keep the device awake while you do the experiments (although you might need to recharge the device every few hours). It might be possible to do something about it on the OS level if you root your devices, although that would need a bit more digging. Best regards, Filip Havlicek 2011/7/20 Chris Conry cjco...@gmail.com Thanks for the answers, Makes sense now, I am using the myTouch 4g and LG ally, sadly both of them I guess turn off their sensors. Its good to hear that the Nexus and some 2.3 device keep it on and hopefully other manufacturers adopt this. I guess i'm going to try and find a work around. Any suggestions? Thank you On Wed, Jul 20, 2011 at 12:42 PM, Filip Havlicek havlicek.fi...@gmail.com wrote: Partial wake lock works just fine with accelerometer sensor on Nexus One 2.2 (tested this for over than 6 months as a part of my research), although this might not be the case for different combination of device and OS version. 2011/7/20 Dianne Hackborn hack...@android.com Prior to 2.3 the sensors were turned off when the screen went off in order to reduce battery use. This was changed on 2.3, though it's possible we are actually going to end up regretting that change. :p Also even as of 2.3, I wouldn't be surprised if some device's drivers are still turning off the sensor hardware as part of their power management when the screen goes off. On Wed, Jul 20, 2011 at 8:53 AM, Chris Conry cjco...@gmail.com wrote: And your guess was completely correct. Thank you. The problem is still happening, as soon as I hit the power button the data stops logging. Is there something else im missing about wakelock? On Wed, Jul 20, 2011 at 11:26 AM, Mark Murphy mmur...@commonsware.com wrote: Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and look at the stack trace associated with your runtime error. My guess is that you do not hold the WAKE_LOCK permission. On Wed, Jul 20, 2011 at 11:21 AM, Chris Conry cjco...@gmail.com wrote: 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