Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;

Contributor ,
Sep 26, 2013 Sep 26, 2013

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

TOPICS
ActionScript
509
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation