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
Trusted Contributor
Posts: 117
Registered: ‎09-06-2011
My Device: 9900
My Carrier: myself
Accepted Solution

How to know when the garbage collector/timer icon is active

Hi,

 

I want to listen to changes on the screen of the phone, I seen peter made a suggestion in another thread a couple of years ago which entailed using locateDfference, however he noted a potential hole in his suggestion where in the case when the timer icon is showing - the screen is always changing but not really relevent changes to the screen are taking place, only the network indicator and timer icon trigger the changes.

 

I am now trying to fill them holes, my code is detecting the difference in bitmaps from screenshots, the code works but when the garbage collertor is active it is triggering a change detected in my code.

 

I am thinking the simplest option is to ask the api is the garbage collector active - I have printed out visible applications and the garbage collector is never one of them but I do see the processid is changing all the time and so maybe one of these processid I see in the console is the garbage collecvtor and I can detect when this is active - anyone know if i can find the processid of the garbage collector or listen for whern it is active (showing the timer icon)?

 

If this is not possible then maybe if I can get correct ratio for the timer per size of screen then i can work around the icon.

 

Any suggestions how to overcome my problems are welcome.

 

Thank you.

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

Re: How to know when the garbage collector/timer icon is active

gc is a part of the virtual machine, not an application on the phone.
there is no api for that.
----------------------------------------------------------
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
Trusted Contributor
Posts: 117
Registered: ‎09-06-2011
My Device: 9900
My Carrier: myself

Re: How to know when the garbage collector/timer icon is active

Thank you for your reply Simon.

 

Can anyone give me suggestion as to how to know when the timer is active? - it would save a lot of battery power!

 

Thanks.

Developer
Posts: 19,616
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to know when the garbage collector/timer icon is active

Just a thought, will your applicaiton even run while the gc is running?

Trusted Contributor
Posts: 117
Registered: ‎09-06-2011
My Device: 9900
My Carrier: myself

Re: How to know when the garbage collector/timer icon is active

Thanks for replying Peter, the app loops taking a screenshot and comparing this screenshot to lastBitmap, if there are changes it will send these changes over socket -  I might be able to detect centre of screen if I can workout a constant size of timer per screen size - but for now I'm investigating the simpler way of detecting if the timer is visible. Yes it does currently trigger changes and therefore network activity so i assume its able screenshot when the timer shows.

Developer
Posts: 19,616
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to know when the garbage collector/timer icon is active

That is shame...  Like Simon, I am n0t aware of a way to detect that the gc is running or showing the icon, sorry.

Trusted Contributor
Posts: 117
Registered: ‎09-06-2011
My Device: 9900
My Carrier: myself

Re: How to know when the garbage collector/timer icon is active

ok, thanks anyway. Maybe I can detect centre of screen and workout the size of timer icon and skip it - ill do some tests on different size screens once i am at that stage to see if i can always workout size of timer icon.