Android splash screen doesn't show if orientation is wrong

Hi everyone,

I’ve got a minor issue with Android splash screens which would be nice to solve. My game is designed for landscape only, and if I have my device in portrait mode when I launch the game, it all works fine except that the splash screen doesn’t show. When I tap the icon, the system seems to freeze for a few seconds instead of showing the splash screen, and then the orientation switches and the game appears post-splash. If the device is in landscape orientation already when I start the game, the splash screen appears fine.

I’ve tested and noticed this on two devices running older Android versions - one runs 5.1 and the the other is 6.0. I also notice that the splash screen does show on newer emulated versions regardless of the orientation, so maybe this is specific to certain OS versions.

This can be recreated by making a new empty MG Android project with the following things set:

_graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;

…and in the Android activity:

ScreenOrientation = ScreenOrientation.UserLandscape

I wonder if anyone else has seen the same problem?

Thanks :slight_smile:

I have found a lot of issues with orientation and resolution on Android.
I have a couple of fixes for this, you can find the build here

You’d have to set ScreenOrientation = ScreenOrientation.FullSensor and leave it at that.
It will take the orientation from _graphics.SupportedOrientations.

here is my complete config.

[Activity(Label = "myGame"
	, MainLauncher = true
	, Icon = "@drawable/icon"
	, AlwaysRetainTaskState = true
	, LaunchMode = LaunchMode.SingleTask 
	, ScreenOrientation = ScreenOrientation.FullSensor
	, ConfigurationChanges = 
		ConfigChanges.Orientation | 
		ConfigChanges.Keyboard | 
		ConfigChanges.KeyboardHidden |
		ConfigChanges.ScreenSize |
		ConfigChanges.ScreenLayout |
		ConfigChanges.UiMode |
		ConfigChanges.SmallestScreenSize
)]

Although I do not have a splash screen, I have an intro screen implemented in code.
I don’t know if that will fix your problem.

Thanks for the reply - ah so it’s not just me then! I used to have FullSensor, but I didn’t like how the splash screen was also portrait if I launch in portrait mode! Maybe I can come up with a better splash that looks good in portrait and landscape!

…or do different resource files for each.

I just got round to trying this - if I put FullUser in the activity metadata, the and launches in portrait mode even if I have _graphics.SupportedOrientations set to Labdscape only.

I might try creating a separate activity for my splash screen and see if that helps at all.

FullUser will set the orientation to whatever the user has set as his/her preference, and the functionality of SupportedOrientations has been stripped from MG, it doesn’t do anything nowadays.

I suppose the splash screen is controlled from the app metadata and shown by the OS before your app code is loaded/run.
Additionally, do not push the limits of MG further that what it can handle, leave the activity1.cs as is -being the first and only activity- and do thing from inside the game1.cs. Scenarios where you load/unload multiple AndroidGameActivity instances are not supported/tested and will most likely corrupt internal MG state.