I am building an Android application which includes a Unity 3d interactive experience.
I have imported the Unity project into Android Studio but when launched the activ
for Unity version 5.5 best way to avoid Immersive Mode in Android is to pass in the constructor not an Activity but to cast of the ApplicationContext to the Wrapper Context.
mUnityPlayer = new UnityPlayer((ContextWrapper) getApplicationContext());
That works because in the obfuscated UnityPlayer.class (in unity-classes.jar) there is a check of instance.
private void h() {
if(this.h instanceof Activity) {
((Activity)this.h).getWindow().setFlags(1024, 1024);
}
}
So if it's not an Activity the UnityPlayer.class doesn't set the flag.