Search code examples
iosactionscript-3flash-builder

Flash Builder Debugger terminates when the screen locks on iPhone/iPad while building a mobile application


I am building an app for iOS in ActionScript. During debugging, whenever the screen locks, the debugging instance terminates while the app still runs on the iPhone/iPad. Is there a event fired when the screen locks? I tried both SUSPEND and DEACTIVATED events on the Native Application. But neither are being fired. As the debugger terminates, even though the app is still running on the device, I did not find a way to figure out what is causing the debugger to terminate.

Any help?


Solution

  • That is the normal behaviour of the debugger. Once the phone goes to sleep your app is effectively put in background mode so can't communicate with the debugger. You can use systemIdleMode within your app to prevent the phone from going to sleep.

    import flash.desktop.NativeApplication;
    import flash.desktop.SystemIdleMode;
    
    NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;