How do I force the game to enter background if the back button is pressed?

I got the back button working for my game by overloading the “keyBackClicked” method and it works fine for all my layers. Now when I get to the main menu of my game I would like to force the game to enter background if the back button is pressed and not terminating the app. I want the back button to behave as if the home button was pressed.
I’ve tried ‘CCDirector::sharedDirector()->end();’ but that would actually terminate the game and I don’t want that.

Any ideas? Thanks :slight_smile:

I have no answer, as I am looking for the same thing.

I’m sorry the engine hasn’t implement this requirement. I think you can implement it by add custom JNI method.

BTW, I don’t think it’s a rational requirement. We can consider it from a user perspective:
If I press back, what I needed is quit the game/app.
When I want to let the game/app enter background, I will press home instead.

Hope it’s helpful!

@zhangbin
At least in Android entering background using the back key is very common.
Gmail, Youtube, WhatsApp… almost all the popular apps allow it.

Has anyone fixed this yet?

Has anyone found the answer to this?