[android] Sound not stoping when press home button

[android] Sound not stoping when press home button
0.0 0


Hi all,
I try to develop a game using cocos2d-x 0.12.0, and i use the following code to play background music:
SimpleAudioEngine::sharedEngine()->playBackgroundMusic(“SpaceGame.wav”,true) ;

But when the music is playing, I press the home button in my android phone, the phone go to home screen, but the background music still play in the background, how I can stop this?



Check the applicationDidEnterBackground method in the app delegate, you should pause the music there with SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();


It works, thanks!