Using the back button on Android with Cocos2d-x 3

Among the many changes done in version 3 of cocos2d-x CCLayer::backKeyClicked() has been deprecated. So how do you catch that back key click these day?
Here’s how, you need to override Layer::onKeyReleased() and compare the value of keyCode to KEY_ESCAPE, as shown in the following code

void MyLayer::onKeyReleased(EventKeyboard::KeyCode keyCode, Event *event) {
	if(keyCode == EventKeyboard::KeyCode::KEY_ESCAPE) {
			Handle the back click

From there you just need to handle the click.
You will also need to enable the Keypad, otherwise the layer will not get notifications on such interactions.
You do that using Layer::setKeyboardEnabled(), set it to true in your Layer’s init() function.
In versions of cocos2d-x 3 prior to v3.3 you would use Layer::setKeypadEnabled() instead, which has been deprecated in later versions.