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:
Tell the native application to stay awake:
To set the native application to normal behavior again, use this code:
Keep in mind that blocking the idle behavior has a negative impact on battery life. Test it and use it with caution.