I'm writing an app that disables the screen dim and keygaurd lock while the app is in use, but when a user navigates away from the app (i.e. goes to the home screen) then the screen dim and keygaurd is re-enabled. I'm testing this on physical devices and it works on all other android devices that I have tested except for Kindle Fire. So, when I go to the home screen and navigate away from my app the keygaurd and screen dim is still disabled so the kindle just stays on unless I manually locked it. I know Kindle Fire is a modified version of the Android operating system, so it kind of makes sense that some things might work differently on a kindle. I was wondering if anyone else has solved this issue or has any ideas about how to make it work? Here is the code I'm using and I have DISABLE_KEYGUARD and WAKE_LOCK permissions selected:
stage.addEventListener(Event.DEACTIVATE, onLeave);
stage.addEventListener(Event.ACTIVATE, onComeBack);
private function onLeave(e:Event):void
{
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.NORMAL;
movieHandler.movieScreen.pauseCurrentMovie();
}
private function onComeBack(e:Event):void
{
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
}
I know that the onLeave function gets executed because the movie that is playing gets paused when I go to the home screen. If I comment out that line then then the sound would just keep playing. Thank in advance for any help.