1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    12
    Vote Rating
    0
    mmandell70 is on a distinguished road

      0  

    Default Unanswered: Keep Phone Awake

    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!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,074
    Answers
    3501
    Vote Rating
    855
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    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 services@sencha.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.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    12
    Vote Rating
    0
    mmandell70 is on a distinguished road

      0  

    Default


    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.

Thread Participants: 1