Skip to main content
Pouradam
Inspiring
September 26, 2013
Question

NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;

  • September 26, 2013
  • 0 replies
  • 519 views

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

This topic has been closed for replies.