I’ve a game that has a few different Android configuration builds where one of it is in a vanilla form which basically doesn’t have any ad libraries, no internet connection and no googleplay integration. In this version, I observed that the backbuffer width and height is wrong on devices which has notch and virtual buttons. The same basic initilization code runs the same on all versions and is correct on all other version but not on that one. I use the same full screen procedure where I’ve a theme like this :
<style name="Theme.Splash" parent="android:Theme">
And also use Window flags like this while the main acitivity is being created :
//Make full screen
if (Android.OS.Build.VERSION.SdkInt >= BuildVersionCodes.P)
Window.Attributes.LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.ShortEdges;
Anybody come across in such an issue before?
bug feature in mg android.
Here is a previous reply on how you can fix it.
Many thanks for pointing out this thread!
I believe I came across your custom build before but gave up to use my own custom build which contains some other things for my needs for some reason. Anyway, I tried your build and it seems that it works a little bit better than the official one as now I can see my game in fullscreen but with a few issues. Since you are using “FullSensor” at start and than determine the screen orientation, some of my early initialization codes which calculates the bezel image locations doesn’t work properly, especially if I hold the device in portrait at launch. So what I would like to ask whether there is a way to launch the activity as “LandscapeSensor” as I already have in the GooglePlay/Non-Vanilla version?
You can’t do that. FullSensor is required to correctly detect the starting orientation.
In fact it will throw an exeption with a message to change it back.
You have to set the allowed orientation from within the Game class. That should work on all platforms that support orientation without changes in platform files.
See this sample back from xna/wp7 on how to do that.
you might also need to listen at orientation change event.
I understand and will adjust my code. There is one last thing I would like to ask, using your build, the navigationbar portion still seems to be not included, is there any other code that I should include for that? I tried to hide the navigationbar using Window.DecorView.SystemUiVisibility but that doesn’t seem to have any effect?
In terms of unexpected backbuffer sizes on Android (Google Play registered) titles, there is a fascinating phenomena detailed in this post that might also be worth considering:
I just wanted to update the situation and give a possible solution for future reference.
It seems that as soon as I added “google play services (games)” library into the game, everything started to work as it should. I did get the proper fullscreen and also the OS stopped complaining that my app is being built with an old version of Android and needs to be updated. So in short, even with on a vanilla project, it seems google play services (games) is more or less a must.