I’m getting issues in android 9 version and android 10 version.In Android 6 , 7 , 8 work like a charm but when i tap back button i android 9 and android 10 game already quit. Anyone have same my issues
I don’t have any problems like yours on Android 9. Try usb debugging to see what’s happening.
You may try to register empty function on back button event.
thanks you for suggest me
Hi, do you have resolved this issue? because we have wrote this:
cc.systemEvent.on(cc.SystemEvent.EventType.KEY_UP, this.onKeyUp, this);
…
onKeyUp(event) {
var script = this;
if(cc.BACKBUTTONID.currentID[0] !== script.ID)
return;
if (event.keyCode === cc.macro.KEY.back) {
// the back button of Android Device is pressed
// maybe it's not work in Web environment
this.emit();
}
else if (event.keyCode === cc.macro.KEY.backspace) {
// the backspace of PC/Mac is pressed
this.emit();
}
else if (event.keyCode === cc.macro.KEY.escape) {
// the escape of PC/Mac is pressed
this.emit();
}
},
but don’t works on android device (on PC works with ESC key) missing something? thanks for help!
If you use api 28 or higher then add this this.getGLSurfaceView().requestFocus();
to onCreate in AppActivity.java
4 Likes
it’s very useful. Thanks alot