Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Preventing sleep mode on android

Hi.

How works on Android Titanium.App.idleTimerDisabled = true; ?
i need my application never go in sleep mode.

I insert into my code but doesn't work.

I declare this at the top of my code and nothing happened.
I declare inside a function and nothing happended.

There's some trick to use it?

Could you help me?

— asked November 10th 2010 by Francesco Soccolini
  • android
  • idle
  • mobile
  • mode
  • sleep
0 Comments

8 Answers

  • Hi everyone. I too wanted to keep my application to keep the screen on and preventing sleep mode (esp Android). I was looking for alternatives to Titanium.App.idleTimerDisabled and i stumbled upon keepScreenOn property of Titanium.UI.View. It seems to be doing the trick for me.

    Hope this helps

    — answered August 10th 2012 by Harman Dhillon
    permalink
    1 Comment
    • Not worked for me where is problem ?

      Titanium.UI.View.keepScreenOn = true;
      

      — commented November 23rd 2012 by Sko
  • I'm sorry that the documentation doesn't call it out, but that is an iPhone only property at this time.

    — answered November 11th 2010 by Don Thorp
    permalink
    1 Comment
    • Why does nobody change the documentation ?????????????
      There's still no info :-(

      You guys should spend more time on the docs, definately.
      This is the 7th!!! time, that the docs are not correct for me.
      Wanting much money for ti+ but not able to create correct docs…
      You have the time to answer questions like this, why dont you have time to edit the docs.

      — commented March 23rd 2011 by Frank Bösing
  • Someone could help me?

    There's some tricks to declare this behaviour on AndroidManifest.custom.xml?

    Regards

    — answered November 10th 2010 by Francesco Soccolini
    permalink
    0 Comments
  • You're not alone, see my post/ticket here:

    http://developer.appcelerator.com/question/70771/prevent-screen-from-turning-off-android

    — answered November 10th 2010 by Anthony Webb
    permalink
    0 Comments
  • Any headway on this? Is idleTimerDisabled already available for Android? If not, please update the documentation accordingly, it's very frustrating to keep trying and finally come to the conclusion the whole method is not available at all in Android.

    — answered March 4th 2011 by Jeroen Kntl
    permalink
    0 Comments
  • Is there any update? it's still not working

    — answered October 2nd 2011 by Eyal Gaon
    permalink
    0 Comments
  • I need this function available on Android too. Is there any news yet?

    — answered November 13th 2011 by Mel Maxwell
    permalink
    1 Comment
    • to summarize my current frustration(correct me if im wrong):

      1. you cant set a timer that works in sleep (even with services).
      2. you cant disable sleep in android.
      3. you cant create countdown time in android (w/o any additional module).
        === you cant not count down time with appcelrator on android, for thos of you out there who haven't started using appcelerator heavily this should be a good reason to reconsider.

      — commented December 29th 2011 by eran shlomo
  • I have the same problem working on sdk 2.1 and I can´t understand why developers can´t solve that but… testing too much, setting up the permission WAKE_LOCK and setting the data conection ON (that´s the trick I think) My background service works very well.

    I hope this help.
    Excuse my english.

    — answered September 20th 2012 by Juan Ramón Jimenez
    permalink
    1 Comment
    • No, it doesn't work. I think you have a service running in background that prevent your phone going to sleep mode. P.e. when I try my own service (written with Titanium) it doesn't work in sleep mode (WAKE_LOCK doesn't work). But if I start a radio app that run in background and prevent going to sleep mode, then my service works well.

      — commented May 3rd 2013 by Avelino Garcia
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.