Music keeps playing when returning from sleep mode

I have a problem with music on Motorola Xoom (3.1). There is a music playing in my game. After some time of user inactivity the device goes to sleep mode. When I wake it up and the screen with unlock button comes up the game music starts to play in the background even when the game should be paused -it is quite strange (and annoying :slight_smile: )

If I leave the game by pressing the Home button, the music stops and starts playing on return as expected.

Does anyone know how to solve that? Isn’t there, for instance, any way of detecting when the device goes into sleep mode (either because of the inactivity time or when the user presses the power button) so that I could stop the music from the script?

Thanks!

Hmm, it seems that other games (even those not powered by Unity like Angry Birds) suffer from this too… I guess I’ll have to live with that :slight_smile:

Well I pick on this thread as I have the same issue. Anyone has a solution for this problem or do we have to live with it? I tried OnApplicationPause, but that doesn’t solve the problem.

I’m getting a similar behaviour on iPad. Anyone else still getting this?

Here is a blog post about that exact problem on the Android Developers blog. Unfortunately you might have to do some Java plugins to get the messages you need to fix this. I haven’t tried yet.

Thanks Chris!