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
Highlighted
Developer
Posts: 204
Registered: ‎07-09-2009
My Device: Not Specified

Using LED in app; after close, indicators don't resume

I made an app that uses the LED. After app closes, even though I take all steps to make sure everything is deallocated & terminates, the LED no longer works for the coverage indicator or (so I'm told) berrybuzz, but it does work for email notification. If power off (without batt pull), 1st time on power-on the covg indic flashes once but then stops. After 2nd power cycle (still no batt pull), it is back to working fine! If I turn covg indic off then back on that fixes it too, with no power-off. The app has a timer thread that keeps changing the LED. At close, I cancel both the Timer and the TimerTask and nullify all references, then call garbage collector, and also set a variable that makes the timertask just return if it does somehow continue to run. So I have a hard time believing that task is still running in background holding the LED 'off'. Why does turning the indicator off then on fix it? I thought maybe the indicator is detecting that an app is using the led and stopping to avoid interfering with my app, but how do I let it (and berrybuzz etc.) know it's ok to resume indicators when I exit? Thanx
Developer
Posts: 193
Registered: ‎02-27-2009
My Device: Not Specified

Re: Using LED in app; after close, indicators don't resume

When you use the LED API you don't "hold" the LED. You merely change its state (color, blinking, on, off etc). Trouble is, you don't know what the previous state is, so there is no reliable way to restore it. And if another app changes the LED state, there is no way for *your* app to know this. So neither the coverage indicator nor BerryBuzz knows that you changed the LED state from whatever they wanted, and will not reset the LED until they think the LED state needs changing. If your phone loses network coverage and regains it, you will find the green coverage indictator flashing again. One way I've found to restore the coverage indicator after playing with the LED is to use the BB notifications mechanism: when a notification that has LED enabled turns off, the coverage indicator is restored.

Developer
Posts: 204
Registered: ‎07-09-2009
My Device: Not Specified

Re: Using LED in app; after close, indicators don't resume

Could you give a brief code example or point me to the API?  I'm not sure what you mean by notifications mechanism; I looked at NotificationsManager but don't understand what you're getting at, unless you mean picking some system setting, reading its status, changing it,and then changing it back.

Thank you,