Skip to main content
Inspiring
September 26, 2012
Question

Screen turns off immediately when setting systemIdleMode to NORMAL after having been in KEEP_AWAKE

  • September 26, 2012
  • 2 replies
  • 2055 views

I've found a little issue in Android...

In my application I download some files the first time it's run. Since it takes a couple of minutes without user input, the screen turns off automatically. I've found some tablets not only turn off the screen but also interrupt the download altogether when going to sleep, so to avoid this I'm using this to prevent the screen from turning off (is there any other workaround to prevent downloads being interrupted by sleep?):

NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;

Of course, I've also added the WAKE_LOCK and DISABLE_KEYWARD permissions to my app descriptor, so the above code works. The problem is that I don't want the app to stay awake all the time, so after the download finishes, I'm setting the screen back to normal with:

NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.NORMAL;


But after executing that, the screen goes off immediately, instead of waiting for a minute or so before dimming the screen. It's as if the dimming was triggered already during the download process, but didn't actually happen because of the KEEP_AWAKE setting, and then when switching to NORMAL, the screen dimming takes place immediately so it turns off.

Is this an intended behaviour or should I file a bug?

How can I manage to set the systemIdleMode to NORMAL but still have the screen on waiting a bit before going to sleep? Turning off the screen as soon as the download is finished is confusing for the user, who might think the app has frozen when it's really just in sleep mode (and the user has to unlock the screen before going back to the app).

This happens in just about any version of AIR 3.x (and probably below).

Also, it happens in iOS as well, but it's less dramatic because the screen just dims a little (app is still visible) when setting systemIdleMode to NORMAL, instead of turning off completely and locking the screen, which is the behaviour in Android.

This topic has been closed for replies.

2 replies

Inspiring
November 15, 2012

this work with iOS 6.0, me app lock

OMA2kAuthor
Inspiring
November 15, 2012

undereyes wrote:

this work with iOS 6.0, me app lock

What do you mean? That it doesn't happen in iOS 6.0 anymore? What do you mean with "me app lock"? Please, elaborate

Inspiring
November 16, 2012

wow, I'm sorry, I was sleeping.

I'm trying to write this source code to avoid screen lock, but it does not work.

I don't know if this is by iOS6 or packaged with AIR 3.5.

Can anyone post a sample code that have tested it with AIR 3.5 + iOS6 ?

chris.campbell
Legend
September 26, 2012

This sounds like a bug to me.  Would you mind adding it to bugbase.adobe.com?  Please post back with the bug number and I'll take a look.

Thanks,

Chris

OMA2kAuthor
Inspiring
September 26, 2012
chris.campbell
Legend
September 26, 2012

Thank you