Releases: mesmotronic/air-ane-fullscreen
AndroidFullScreen ANE 1.5.64
Release notes
This release adds support for 64-bit Android and includes a new setSystemUiVisibility
method which can be used in the same way as Android's native method of the same name to request that the visibility of the status bar or other screen/window decorations be changed.
This ANE is released under BSD license and requires Adobe AIR 33+.
How does it work?
This ANE enables developers to offer users a true full screen experience in the Adobe AIR apps for Android.
Using Android 4.0+, you can use true full screen in "lean mode", the way you see in apps like YouTube, expanding the app right to the edges of the screen, hiding the status and navigation bars until the user next interacts. This is ideally suited to video or cut-scene content.
In Android 4.4+, however, you can now enter true full screen, fully interactive immersive mode. In this mode, your app will remain in true full screen until you choose otherwise; users can swipe down from the top of the screen to temporarily display the system UI.
If you need to fix it, fork it!
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.
Before you start
To avoid cropping, always ensure that you're using <fullScreen>false</fullScreen>
in your app.xml
and stage.displayState
is set to StageDisplayState.NORMAL
when using any of the full screen modes invoked by this ANE.
The examples below show how to achieve the best possible full screen experience.
Code example
Using the ANE in your app couldn't be easier:
import com.mesmotronic.ane.AndroidFullScreen;
// Methods
AndroidFullScreen.stage = stage; // Set this to your app's stage
AndroidFullScreen.isSupported; // Is this ANE supported?
AndroidFullScreen.isImmersiveModeSupported; // Is immersive mode supported?
AndroidFullScreen.immersiveWidth; // The width of the screen in immersive mode
AndroidFullScreen.immersiveHeight; // The height of the screen in immersive mode
AndroidFullScreen.fullScreenWidth; // The width of the screen in the best available full screen mode
AndroidFullScreen.fullScreenHeight; // The height of the screen in the best available full screen mode
AndroidFullScreen.fullScreen(); // Switch your app to the best available full screen mode
AndroidFullScreen.showSystemUI(); // Show system UI
AndroidFullScreen.leanMode(); // Hide system UI until user interacts
AndroidFullScreen.showUnderSystemUI(); // Extend your app underneath the system UI (Android 4.4+ only)
AndroidFullScreen.immersiveMode(); // Hide system UI and keep it hidden (Android 4.4+ only)
AndroidFullScreen.immersiveMode(false); // Hide system UI until user swipes from top (Android 4.4+ only)
// Example custom full screen mode
AndroidFullScreen.setSystemUiVisibility(AndroidFullScreen.SYSTEM_UI_FLAG_FULLSCREEN | AndroidFullScreen.SYSTEM_UI_FLAG_LOW_PROFILE);
// Events (will only work if ANE is supported)
NativeApplication.nativeApplication.addEventListener(AndroidFullScreen.ANDROID_WINDOW_FOCUS_IN, focusHandler);
NativeApplication.nativeApplication.addEventListene(AndroidFullScreen.ANDROID_WINDOW_FOCUS_OUT, focusHandler);
function focusHandler(event:Event):void
{
trace(event.type);
}
All methods return Boolean values: true if the action was successful, false if it wasn't (or isn't supported); if you're using the ANE in an app for a platform other than Android, all properties and methods will return false.
The immersiveWidth
and immersiveHeight
properties return the screen width and height available in immersive mode (or with the system UI hidden), or 0 if the ANE isn't supported.
Therefore, the simplest way to give users the best possible interactive full screen experience in your app is to start your app with <fullScreen>false</fullScreen>
in your app.xml
and use:
AndroidFullScreen.stage = stage;
AndroidFullScreen.fullScreen();
An easy way to extend your app underneath the status and navigation bars is:
if (!AndroidFullScreen.showUnderSystemUI())
{
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}
And a great way to offer full screen video playback is:
if (!AndroidFullScreen.leanMode())
{
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}
Getting the immersive screen size
You can use the immersiveWidth
and immersiveHeight
properties to find out the dimensions of the screen with the system UI hidden, regardless of the current screen state.
To find out the stage size after calling fullScreen()
, immersiveMode()
or leanMode()
, you must wait until the next RESIZE
event before the stage.stageWidth
and stage.stageHeight
properties are updated; the properties of the Capabilities
object are not updated and are therefore incorrect.
Starling
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 switching between the normal app state and true full screen.
Examples
Examples are in the example-*
folders of the source download for this release.
To use the examples, you will need to copy the ANE into the appropriate folder, extensions
in most cases, before building.
Make a donation
If you find this project useful, why not buy us a coffee (or as many as you think it's worth)?
AndroidFullScreen ANE 1.4.6
Release notes
This release improves performance in Android 6 Marshmallow and resolves issues #27, which caused problems when testing apps in the AIR simulator.
This ANE is released under BSD license and requires Adobe AIR 19+.
Workaround for issue #24 (black bar on Android 6.0)
A bug in Android 6.0 means some users are seeing a black bar at the bottom of their screen when using this ANE. This issue is resolved in Android 6.0.1, but if you haven't received the upgrade yet, you can fix it by changing the stage orientation twice, for example:
AndroidFullScreen.stage = stage;
AndroidFullScreen.fullScreen();
stage.setOrientation(StageOrientation.UPSIDE_DOWN);
stage.setOrientation(StageOrientation.UPSIDE_DOWN);
(Thanks to @m72 for the workaround)
Code example
Using the ANE in your app couldn't be easier:
import com.mesmotronic.ane.AndroidFullScreen;
// Methods
AndroidFullScreen.stage = stage; // Set this to your app's stage
AndroidFullScreen.isSupported; // Is this ANE supported?
AndroidFullScreen.isImmersiveModeSupported; // Is immersive mode supported?
AndroidFullScreen.immersiveWidth; // The width of the screen in immersive mode
AndroidFullScreen.immersiveHeight; // The height of the screen in immersive mode
AndroidFullScreen.fullScreenWidth; // The width of the screen in the best available full screen mode
AndroidFullScreen.fullScreenHeight; // The height of the screen in the best available full screen mode
AndroidFullScreen.fullScreen(); // Switch your app to the best available full screen mode
AndroidFullScreen.showSystemUI(); // Show system UI
AndroidFullScreen.leanMode(); // Hide system UI until user interacts
AndroidFullScreen.showUnderSystemUI(); // Extend your app underneath the system UI (Android 4.4+ only)
AndroidFullScreen.immersiveMode(); // Hide system UI and keep it hidden (Android 4.4+ only)
AndroidFullScreen.immersiveMode(false); // Hide system UI until user swipes from top (Android 4.4+ only)
// Events (will only work if ANE is supported)
NativeApplication.nativeApplication.addEventListener(AndroidFullScreen.ANDROID_WINDOW_FOCUS_IN, focusHandler);
NativeApplication.nativeApplication.addEventListene(AndroidFullScreen.ANDROID_WINDOW_FOCUS_OUT, focusHandler);
function focusHandler(event:Event):void
{
trace(event.type);
}
All methods return Boolean values: true if the action was successful, false if it wasn't (or isn't supported); if you're using the ANE in an app for a platform other than Android, all methods will return false.
Make a donation
If you find this project useful, why not buy us a coffee (or as many as you think it's worth)?
AndroidFullScreen.ane 1.3.3
Release notes
Version 1.3 handles the change in window focus that occurs when Android displays system dialogues over your AIR app to ensure that immersive mode is maintained even after the dialogue is closed.
This release resolves issue #16, an immersive mode switching issue on Samsung Galaxy S3 Neo.
This ANE is released under BSD license and requires Adobe AIR 17+.
Using the ANE
Add the ANE to your library in the usual way and you're ready to go.
import com.mesmotronic.ane.AndroidFullScreen;
// Methods
AndroidFullScreen.isSupported; // Is this ANE supported?
AndroidFullScreen.isImmersiveModeSupported; // Is immersive mode supported?
AndroidFullScreen.immersiveWidth; // The width of the screen in immersive mode
AndroidFullScreen.immersiveHeight; // The height of the screen in immersive mode
AndroidFullScreen.showSystemUI(); // Show system UI
AndroidFullScreen.leanMode(); // Hide system UI until user interacts
AndroidFullScreen.showUnderSystemUI(); // Extend app underneath system UI (Android 4.4+)
AndroidFullScreen.immersiveMode(); // Hide system UI and keep it hidden (4.4+)
AndroidFullScreen.immersiveMode(false); // Hide system UI until user swipes from top (4.4+)
// Events
NativeApplication.nativeApplication.addEventListener(AndroidFullScreen.ANDROID_WINDOW_FOCUS_IN, focusHandler);
NativeApplication.nativeApplication.addEventListener(AndroidFullScreen.ANDROID_WINDOW_FOCUS_OUT, focusHandler);
function focusHandler(event:Event):void
{
trace(event.type);
}
All methods return Boolean values: true if the action was successful, false if it wasn't (or isn't supported); if you're using the ANE in an app for a platform other than Android, all properties and methods will return false.
Examples
The examples.zip
download contains basic AS3 and Flex examples for Flash Builder, an AS3 example for FlashDevelop and an FLA example created in Flash CC.
To use the examples, you will need to copy the ANE into the appropriate folder, extensions
in most cases, before building.
AndroidFullScreen.ane 1.2.1
This ANE requires Adobe AIR 13+
Version 1.2.1 resolves an issue with isImmersiveModeSupported
and adds two new properties: immersiveWidth
and immersiveHeight
, which can be used to find out the size of the screen in immersive mode (or with the system UI hidden) at any time.
Using the ANE in your app couldn't be easier:
import com.mesmotronic.ane.AndroidFullScreen;
AndroidFullScreen.isSupported; // Is this ANE supported?
AndroidFullScreen.isImmersiveModeSupported; // Is immersive mode supported?
AndroidFullScreen.immersiveWidth; // The width of the screen in immersive mode
AndroidFullScreen.immersiveHeight; // The height of the screen in immersive mode
AndroidFullScreen.hideSystemUI(); // Hide system UI until user interacts
AndroidFullScreen.showSystemUI(); // Show system UI
AndroidFullScreen.showUnderSystemUI(); // Extend app underneath system UI (Android 4.4+)
AndroidFullScreen.immersiveMode(); // Hide system UI and keep it hidden (4.4+)
AndroidFullScreen.immersiveMode(false); // Hide system UI until user swipes from top (4.4+)
All methods return Boolean values: true if the action was successful, false if it wasn't (or isn't supported); if you're using the ANE in an app for a platform other than Android, all properties and methods will return false.
The immersiveWidth
and immersiveHeight
properties return the screen width and height available in immersive mode (or with the system UI hidden), or 0 if the ANE isn't supported.
Therefore, the simplest way to give users the best possible interactive full screen experience in your app is:
if (!AndroidFullScreen.immersiveMode())
{
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}
And a great way to offer the best possible full screen video playback is:
if (!AndroidFullScreen.hideSystemUI())
{
stage.displayState = StageDisplayState.FULL_SCREEN;
}
Getting the immersive screen size
You can use the immersiveWidth
and immersiveHeight
properties to find out the dimensions of the screen with the system UI hidden, regardless of the current screen state.
To find out the stage size after calling immersiveMode()
or hideSystemUI()
, you must wait until the next RESIZE
event before the stage.stageWidth
and stage.stageHeight
properties are updated; the properties of the Capabilities
object are not updated and are therefore incorrect.
Starling
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 switching between the normal app state and true full screen.
Examples
The examples.zip
download contains basic AS3 and Flex examples for Flash Builder, an AS3 example for FlashDevelop and an FLA example created in Flash CC.
To use the examples, you will need to copy the ANE into the appropriate folder, extensions
in most cases, before building.
AndroidFullScreen.ane 1.2
This ANE requires Adobe AIR 4+
Version 1.2 of our true full screen ANE for Adobe AIR adds support for Android 4.4's true full screen, fully interactive immersive mode, adding the following methods to the API:
import com.mesmotronic.ane.AndroidFullScreen;
AndroidFullScreen.isSupported; // Is this ANE supported?
AndroidFullScreen.isImmersiveModeSupported; // Is immersive mode supported?
AndroidFullScreen.hideSystemUI(); // Hide system UI until user interacts
AndroidFullScreen.showSystemUI(); // Show system UI
AndroidFullScreen.showUnderSystemUI(); // Extend your app underneath the system UI (Android 4.4+ only)
AndroidFullScreen.immersiveMode(); // Hide system UI and keep it hidden (Android 4.4+ only)
AndroidFullScreen.immersiveMode(false); // Hide system UI until user swipes from top (Android 4.4+ only)
All methods return Boolean values: true if the action was successful, false if it wasn't (or isn't supported).
Therefore, the simplest way to give users the best possible interactive full screen experience in your app is:
if (!AndroidFullScreen.immersiveMode())
{
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}
And a great way to offer the best possible full screen video playback is:
if (!AndroidFullScreen.hideSystemUI())
{
stage.displayState = StageDisplayState.FULL_SCREEN;
}
The examples.zip
download contains basic AS3 and Flex examples for Flash Builder, and an FLA example created in Flash CC.
AndroidFullScreen.ane 1.1
Version 1.1 of our true full screen ANE for Adobe AIR adds support for Android 4.4's true full screen, fully interactive immersive mode, adding the following methods to the API:
import com.mesmotronic.ane.AndroidFullScreen;
AndroidFullScreen.hideSystemUI(); // Hide system UI until user interacts
AndroidFullScreen.showSystemUI(); // Show system UI
AndroidFullScreen.showUnderSystemUI(); // Extend your app underneath the system UI
AndroidFullScreen.immersiveMode(); // Hide system UI in sticky mode (Android 4.4+ only)
AndroidFullScreen.immersiveMode(false); // Hide system UI until user swipes from top (Android 4.4+ only)
The examples.zip
download contains basic AS3 and Flex examples for Flash Builder, and an FLA example created in Flash CC.
This ANE requires Adobe AIR 4+.
AndroidFullScreen.ane 1.0
Enjoy true full scree in your Adobe AIR apps for Android with our new ANE; requires Adobe AIR 4.0+
import com.mesmotronic.ane.AndroidFullScreen;
AndroidFullScreen.hideSystemUI();