Overriding a Dimmed Screen

Must Read

Just post!

After your application is idle for a while, the OS makes the device screen go into dimming mode and sets your device to auto-lock if your settings request it. Note that this is different from AIR on the desktop. On the desktop, playing a video at full screen automatically blocks screensavers and power-saving modes. It does not happen automatically on Android.

If you wish to override this behavior during a certain activity, you need to set the following permissions:

<uses-permission android:name=”android.permission.WAKE_LOCK” />
<uses-permission android:name=”android.permission.DISABLE_KEYGUARD” />

For convenience, place this code in your document class or where you first set up your application settings. Import the needed classes:

import flash.desktop.NativeApplication;
import flash.desktop.SystemIdleMode;

Tell the native application to stay awake:

= SystemIdleMode.KEEP_AWAKE;

To set the native application to normal behavior again, use this code:

= SystemIdleMode.NORMAL;

Keep in mind that blocking the idle behavior has a negative impact on battery life. Test it and use it with caution.


- Advertisement -

Latest News

GAC Group’s Global Expansion Strategy: Key Details Revealed

On August 25th, GAC Group released its 2023 semi-annual report, showing a total operating revenue of 233.532 billion yuan...
- Advertisement -

More Articles Like This

- Advertisement -