Android app not being sent SDL_APP_WILLENTERBACKGROUND

On my Android SDL game when I hit the square button on the simulator, SDL seems to send no message (which I need to receive to save the current game status). But if I then use the square button again to restore my game it gets sent:

SDL_APP_WILLENTERBACKGROUND
SDL_APP_DIDENTERBACKGROUND
SDL_APP_WILLENTERFOREGROUND
SDL_APP_DIDENTERFOREGROUND

I’m using SDL 2.32.8 and I’ve tried on a Nexus 9 API 30 and Pixel 7 API 30 simulators, and I’ve got:

compileSdkVersion 35
minSdkVersion 23
targetSdkVersion 35

Am I doing anything wrong, or is this unexpected behaviour?

1 Like

Anyone know if this is fixed in SDL3?

Where are you attempting to detect the SDL_APP_ messages? I believe you should test for them in an Event Filter (set with SDL_AddEventWatch()) rather than in your main event processing code. That’s what I do, anyway.