Android和IOS手机在锁屏与再次开启时调用的函数与使用方法如下:
ts代码如下:
onLoad() {
//注册事件
this.addListener();
}
addListener(){
cc.game.on(cc.game.EVENT_SHOW, this.showGame, this);
cc.game.on(cc.game.EVENT_HIDE, this.hideGame, this);
}
showGame(){
console.log("显示 --------- Show!");
}
hideGame(){
console.log("锁屏 --------- Hide!");
}