cocoscreator 拉起计费界面后 返回进程关闭 解决方案
作者:互联网
cocoscreator 安卓接渠道计费sdk 拉起计费界面后 返回进程关闭
解决方案:
在Cocos2dxActivity类中
注释掉
//mGLSurfaceView.onPause();
@Override
protected void onPause() {
Log.d(TAG, "onPause()");
paused = true;
super.onPause();
if(gainAudioFocus)
Cocos2dxAudioFocusManager.unregisterAudioFocusListener(this);
Cocos2dxHelper.onPause();
//mGLSurfaceView.onPause();
}
会造成按home键 后台仍然会播放音乐
解决方法:
在AppActivity中修改
@Override
protected void onResume() {
//恢复
app.runOnGLThread(new Runnable() {
@Override
public void run() {
Cocos2dxJavascriptJavaBridge.evalString("cc.audioEngine.resumeAll();");
}
});
super.onResume();
SDKWrapper.getInstance().onResume();
}
@Override
protected void onPause() {
//暂停
app.runOnGLThread(new Runnable() {
@Override
public void run() {
Cocos2dxJavascriptJavaBridge.evalString("cc.audioEngine.pauseAll();");
}
});
super.onPause();
SDKWrapper.getInstance().onPause();
}
标签:Override,界面,void,onResume,cocoscreator,protected,onPause,计费,super 来源: https://blog.csdn.net/qq_37443937/article/details/110431083