Black screen on Restore - Monogame 3.2


I had a game done in Monogame 3.1, but wanted to try 3.2
After installing 3.2 I had an issue with sound - had to use Monogame sources to get over it.
Now when I use home button (go to android pulpit) then restore app screen is black. I tap it a couple of times and get system message that app is not responding asking to terminate.

I got this call stack once, with other attempts nothing was shown:
[IPCThreadState] [DN #5] BR_CLEAR_DEATH_NOTIFICATION_DONE cookie 0x600ec110
[IspDrv] {IspDrv} [~IspDrvImp]
[mtk_dlmalloc_debug] [DEBUG_INFO]FUNCTION try_realloc_chunk Line 6175 address 601d29d0 function 43 action 1 structure type 4 error_member 40 mstate 0 DEBUG bee6f8b0
[mono-rt] Stacktrace:
[mono-rt] at <0xffffffff>


Are your textures tombstoning? I see that.

If you aren’t starting with a clear of the screen to a color other then black, try that and see if the screen itself is getting colored and its just your sprites that are black.

is there any extra message in the application log?

I am having a similar issue here - in fact I’m having a nightmare with resuming Monogame Android applications in general.

There seems to be an issue whereby sometimes when resuming an application the entire screen will go black. I don’t think it is something to to with the textures getting lost as even clearing the screen in a colour is not working. I am also using MonoGame 3.2.

Even the simplest ‘Game’ that just loads a texture and draws it seems to be suffering this issue, every so often (apparently randomly) a pause/resume will cause the entire screen to go black, another pause/resume and (again apparently by chance) everything will go back to normal.

Creating a new SpriteBatch every time a draw occurs seems to make it happen less often but I don’t think this is the optimal approach (and it could be my imagination).

I’m getting the issue both using emulators and testing on a device.

I’m surprised more people aren’t tearing their hair out over this frankly - happy to admit to user error but my test ‘game’ is so simple it’s difficult to see what that might be…


#region Using Statements
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Input;

namespace MonoGame_Android_Test
	/// <summary>
	/// This is the main type for your game
	/// </summary>
	public class Game1 : Game
		GraphicsDeviceManager graphics;
		SpriteBatch spriteBatch;

		private Texture2D gfx_ninja;

		public Game1 ()
			graphics 						= new GraphicsDeviceManager (this);
			graphics.SupportedOrientations	= DisplayOrientation.Portrait;



			Content.RootDirectory = "Content";	            
			graphics.IsFullScreen = true;	

			System.Diagnostics.Debug.Write ("Constructing!");

		/// <summary>
		/// Allows the game to perform any initialization it needs to before starting to run.
		/// This is where it can query for any required services and load any non-graphic
		/// related content.  Calling base.Initialize will enumerate through any components
		/// and initialize them as well.
		/// </summary>
		protected override void Initialize ()
			// TODO: Add your initialization logic here
			base.Initialize ();

			System.Diagnostics.Debug.Write ("Initializing!");

		/// <summary>
		/// LoadContent will be called once per game and is the place to load
		/// all of your content.
		/// </summary>
		protected override void LoadContent ()
			// Create a new SpriteBatch, which can be used to draw textures.
			spriteBatch = new SpriteBatch (GraphicsDevice);

			//TODO: use this.Content to load your game content here 
			gfx_ninja = Content.Load<Texture2D>("ninja");

		/// <summary>
		/// Allows the game to run logic such as updating the world,
		/// checking for collisions, gathering input, and playing audio.
		/// </summary>
		/// <param name="gameTime">Provides a snapshot of timing values.</param>
		protected override void Update (GameTime gameTime)
			// For Mobile devices, this logic will close the Game when the Back button is pressed
			if (GamePad.GetState (PlayerIndex.One).Buttons.Back == ButtonState.Pressed) {
				Exit ();
			// TODO: Add your update logic here			
			base.Update (gameTime);

		protected override void OnActivated (object sender, EventArgs args)
			base.OnActivated (sender, args);

		/// <summary>
		/// This is called when the game should draw itself.
		/// </summary>
		/// <param name="gameTime">Provides a snapshot of timing values.</param>
		protected override void Draw (GameTime gameTime)
			graphics.GraphicsDevice.Clear (Color.CornflowerBlue);
			spriteBatch = new SpriteBatch (GraphicsDevice);
			//TODO: Add your drawing code here
			spriteBatch.Begin ();
			spriteBatch.Draw (gfx_ninja, Vector2.Zero, Color.White);
			spriteBatch.End ();

			base.Draw (gameTime);

Did anyone find a resolution to this? My screen is going black after resuming from sending an email. I can HEAR the game and I can Interact (if I touch the screen where I know a button is, it responds). But the screen is simply black!

Update to the latest MonoGame from GitHub - it’s much, much better on the Android lifecycle stuff.

Even with the latest updates from GitHub, I am continuing to have issues with this. I am also noticing though that GraphicsDeviceManager.DeviceReset does not seem to be getting triggered (although I can see in the logs that the surface and frame buffer are getting destroyed.

I am also seeing this happen on the Platformer2D Monogame Sample. I am testing with a Google Nexus 7 2013.