Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
Posts: 7
Registered: ‎05-10-2011
My Device: 8310
My Carrier: TMUS
Accepted Solution

isForeground () not working properly in firmware 4.6 and bellow

Hello,

 

 

I am developing a game for blackberry using MIDP.

 

I want to pause my game when Switch Application menu appear when OEM menu button hold. I put following code In main looping  to check is Application foreground or not.

 

 

        if(  ! Application.getApplication( ).isForeground( ) )
        {
            hideNotify( );
        }
        else
        {
            if(  ! hasNotified )
            {
                hasNotified = true;
                showNotify( );
            }
        }

 

It work for Firmware above 4.6 but not for 4.6 and below.

I try to trace use JDE 4.6 and found the value of

 

Application.getApplication( ).isForeground( )

 

was always true except after App mimized.

 

Anyone ever facing this issue?

 

 

Thank You,


Hasyim

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: isForeground () not working properly in firmware 4.6 and bellow

probably a bug in the system. maybe you can work around it by using activate/deactivate and changing a boolean flag that you query?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Contributor
Posts: 7
Registered: ‎05-10-2011
My Device: 8310
My Carrier: TMUS

Re: isForeground () not working properly in firmware 4.6 and bellow

The problem is showNotify() and hideNotify() from MIDP not called when Switch app menu appears. That why I can't pause my app or modify some Boolean flags to catch this situation.

I have try put some boolean on keyPressed to catch this, but when it back to App again no showNotify called.

Any other method that can catch when my app is not in foreground?
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: isForeground () not working properly in firmware 4.6 and bellow

ah, sorry, i missed that it is a MIDP app. no clue about that, sorry.

as most devices are above 4.6 nowadays this may not be that big of an issue though. 

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Highlighted
New Contributor
Posts: 7
Registered: ‎05-10-2011
My Device: 8310
My Carrier: TMUS

Re: isForeground () not working properly in firmware 4.6 and bellow

Ok, Thank you. Smiley Happy

Just want to know if any solution for this issue. Because my app become very strange when my app playing a sound and not stopped when phone ringing or other app opened without minimizing my app.