We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3511

Summary: Android: SDL_QUIT event not generated on back key press
Product: SDL Reporter: tower120
Component: eventsAssignee: Sylvain <sylvain.becker>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: sylvain.becker, tower120
Version: 2.0.5   
Hardware: ARM   
OS: Android (All)   
Attachments: patch

Description tower120 2016-12-07 21:46:49 UTC
On my android device Nexus7 2011 (Android 5) SDL_QUIT event never fires.
I can observe only "key down" , "key up" events when press back button.

Or this is "by design"?
Comment 1 Sylvain 2016-12-08 08:53:45 UTC
you have a SDL_QUIT event when the java onDestroy is called. It calls nativeQuit, which fires SDL_QUIT event.

When you press the back button you get a key SDL_AC_BACK.
Comment 2 tower120 2016-12-08 13:19:12 UTC
Well, maybe it would be good to see that explanation in the manual...

Because I didn't saw a single tutorial/example where instead SDL_QUIT, SDL_KEYUP + SDL_AC_BACK processed.
NativeApplication, for example closes by default by back button.
Comment 3 Sam Lantinga 2017-08-11 20:11:23 UTC
Sylvain, what's the expected Android behavior here?
Comment 4 Sylvain 2017-08-11 21:48:48 UTC
According to https://developer.android.com/design/patterns/navigation.html

the smartphone back button is for the navigation. In SDL this is correctly mapped to a SDL_KEYDOWN/UP with keycode SDLK_AC_BACK.

So behavior is as expected.

Maybe some documentation in the include file : "SDL_keycode.h" ?
Or, maybe some android specific doc ?
Comment 5 Sylvain 2017-11-08 13:28:49 UTC
Created attachment 3076 [details]
patch

Patch with some android-documentation to end an application.
Comment 6 Sylvain 2017-11-08 13:31:02 UTC
please check that end-of-line CR/LF are correct, because the patch seems to contain something different.
Comment 7 Sylvain 2018-12-30 13:24:57 UTC
Add some documentation and marked as resolved
https://hg.libsdl.org/SDL/rev/b2422f30f0a6