bluck20 / cocos2d-android-1

Automatically exported from code.google.com/p/cocos2d-android-1
0 stars 0 forks source link

Game Lost Focus When we click Volume Up or Volume Down Button On Motorola xoom #109

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I am developing a game using Cocos2d FrameWork in Android.

i encountered a problem while testing on Motorola Xoom.

What I want to do :-

When User pressed Volume up and Volume down Button All the Animation should 
play with sound .

But What actually Happened:-

when i pressed volume up down button on Motorola Xoom than My Game Lost Focus 
and all Animation Paused but sound is playing according to the volume button 
settings.

This is only when i test my Application in Honey Comb OS.

I am using onWindowFocusChanged method to Resume Game Play.

anyone having encounter this type of problem ?

Please let me know if anyone have solution for this .

Thanks.

I am developing a game using Cocos2d FrameWork in Android.

i encountered a problem while testing on Motorola Xoom.

What steps will reproduce the problem?
1. when i pressed volume up down button on Motorola Xoom than My Game Lost 
Focus and all Animation Paused but sound is playing according to the volume 
button settings.

What is the expected output? What do you see instead?
1.When User pressed Volume up and Volume down Button All the Animation should 
play with sound .

What version of the product are you using? On what operating system?
HoneyComb 3.x (Motorola Xoom)

Please provide any additional information below.

Original issue reported on code.google.com by jaiminme...@gmail.com on 5 Dec 2011 at 11:32

GoogleCodeExporter commented 8 years ago
Hi!

I managed to "get rid" of this problem by changing a line in the 
org.cocos2d.opengl.GLSurfaceView.GLThread.onWindowFocusChanged() method (in 
GLSurfaceView.java):

        public void onWindowFocusChanged(boolean hasFocus) { 
                synchronized(sGLThreadManager) {         
                        mHasFocus = true; //hasFocus;    <------------ THIS LINE    
                        sGLThreadManager.notifyAll();            
                }
                if (LOG_SURFACE) {
                        Log.i("Main thread", "Focus " + (mHasFocus ? "gained" : "lost"));
                }
        }

***WARNING*** I tested it only on Samsung Galaxy Tab (as my app is designed to 
run exclusively on this device), and it seems to work for me. Be warned that 
this may have side effects on other devices, or in other cases of use...

Vincent

Original comment by chere.lo...@gmail.com on 28 Feb 2012 at 2:04

GoogleCodeExporter commented 8 years ago
Hi,

Thanks for the replay. i will do changes according this and do testing in other 
device also.

Original comment by jaiminme...@gmail.com on 29 Feb 2012 at 7:24