This is a simplified version of our popular Android Full Screen ANE that puts your app into the best available full screen mode.
On Android 4.4+, it switches your app into immersive mode, falling back to FULL_SCREEN_INTERACTIVE
display state on earlier versions of Android and other mobile platforms.
Requires Adobe AIR 19+. Released under BSD license, see LICENSE for details.
Download the latest ANE from the releases page on GitHub.
To avoid cropping, ensure that you're using <fullScreen>false</fullScreen>
in your app.xml
and stage.displayState
is set to StageDisplayState.NORMAL
.
Using the ANE in your app couldn't be easier:
import com.mesmotronic.ane.ImmersiveMode;
// Put your app into the best available full screen mode
ImmersiveMode.stage = stage;
// Get the maximum full screen resolution of your app
trace(ImmersiveMode.fullScreenWidth);
trace(ImmersiveMode.fullScreenHeight);
// Events (Android only)
function focusHandler(event:Event):void
{
trace(event.type);
}
NativeApplication.nativeApplication.addEventListener(ImmersiveMode.ANDROID_WINDOW_FOCUS_IN, focusHandler);
NativeApplication.nativeApplication.addEventListene(ImmersiveMode.ANDROID_WINDOW_FOCUS_OUT, focusHandler);
To use this ANE with Starling, add Starling.handleLostContext = true;
at the start of your ActionScript code to prevent Stage3D lost context errors breaking your app when it switches into immersive mode.
This is a free, open-source project, so if you find the ANE doesn't work as you might like with a specific device, configuration or library you're using: fork it, fix it, let us know.
If you find this project useful, why not buy us a coffee (or as many as you think it's worth)?