Copy link to clipboard
Copied
Hi there!
I am developing an App for Android, and I need the App to stay AWAKE while it is runing.
This code does not work for me:
import flash.desktop.NativeApplication;
import flash.desktop.SystemIdleMode;
stage.addEventListener(Event.DEACTIVATE, onLeave);
stage.addEventListener(Event.ACTIVATE, onComeBack);
function onLeave(event:Event):void{
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.NORMAL;
}
function onComeBack(event:Event):void{
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
}
Means when I install this App on Google Nexus 4 (Android version 4.3) it does not stay awake (after a while goes to sleep).
Is there any Default action in Android maybe I need to prevent or disable it first? Or my code contains errors??
Thanks a lot for your time.
Yours,
Ali
Have something to add?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now