打好的APK安装在手机上之后,如果插着线连着电脑,非常容易出现屏幕突然黑屏,然后声音消失。
想解决2个问题:1: 为什么会出现黑屏的情况
2:黑屏后的声音消失应该怎么解决,就算没有连线,当游戏开着的时候不按HOME直接按游戏的开关,然后手机再打开,还是会导致声音消失
-
黑屏的意思?屏幕自己关闭【开发者选项 -> 不锁定屏幕 此时只会变暗,在 显示 -> 休眠 -> 设置最大值】?
-
声音消失,检查AppDelegate.cpp的
void AppDelegate::applicationDidEnterBackground() {
Director::getInstance()->stopAnimation();// if you use SimpleAudioEngine, it must be pause
//此函数是否有调用
SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
}
// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground() {
Director::getInstance()->startAnimation();
// if you use SimpleAudioEngine, it must resume here
//此函数是否有调用
SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
}
在eclipse中调试一下,看下logcat的输出。