8 Mar 2012 9:49 AM #1
Unanswered: Keep Phone Awake
Is there anyway to keep the phone from going to 'sleep'?
I know there are native (Android) methods of handling this like WakeLock and KeepScreenOn, but I can't seem to find a way of doing this with Sencha.
We're writing an application to track our trucks in the field, but when the phone goes to sleep it stops transmitting the GPS coordinates. We're not concerned about power consumption, because the devices will always be using a car adapter.
Thanks for any help!
8 Mar 2012 10:53 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
I would actually setup the device to handle this. The device will sleep when there is no interaction with it, your app can be animating things or loading stores and that won't affect the device going to sleep.Mitchell Simoens @LikelyMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services email@example.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
9 Mar 2012 7:00 AM #3
Are you saying that we should setup each phone so that it doesn't sleep (basically set screen timeout to 'never')? That won't work for us because we have thousands of trucks that will use this software.
If there isn't a way to code stopping the phone from sleeping, is there a way to have a callback function that can fire at a specified interval even if the phone is 'asleep'? So, for example, we could have a callback function that runs every minute, which gets the geolocation of the truck and then goes back to sleep.