Good morning Cocos2dx Community,
Yesterday I release my first game - Color-Shift onto the iOS app store. This was an update to the game that was previously done using cocos2d, and I got to say I really like using this framework. Now my android build is going well there were a few minor glitches happening that I had to resolve. I have two outstanding issues that I would like to fix before shipping the game to android. I will go ahead and state the issues and then give a bit of background on what I have found. First the game’s background music plays in the lock screen. Second the game does not pause when the user hits the multitask button.
So for the background music in the lock screen the way I reproduce this is I run my game hit the power button to sleep the device. Once the device is sleeped I press the power button again to wake it. Once awake I see the android lock screen and I can hear my game’s background music playing. Now in all other cases the background music does stop playing like for example if I minimize the app. I put some logs and found that onResume() is called once the the device wakes. Is there a way to check if the app has focus?
The next issue is that I am playing my game hit the multitask button. And I can see that the game is still running. Again I think that I can solve this if I can somehow listen to something to check if the app is still in focus. I am not sure because I am not an android expert.
Anyways any thoughts on these two problems. Hopefully someone that has ported their game over to android can give some advice. Also the device I am testing on is a Nextbook 7 running ice-cream sandwich but I also tested and confirmed that these issues happen on Samsung devices running Jelly bean.