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
Contributor
magnetix
Posts: 41
Registered: ‎11-11-2010
My Device: Not Specified
Accepted Solution

Device idle, power off, repeating background tasks

I read somewhere that a background thread should not reschedule tasks with too high a frequency, because it will prevent the device entering its "idle state" and therefore drain the battery.

 

I could not find any documentation on this, can anyone please confirm and possibly link to the docs, if they exist? I have a background app that may need to poll for changes every few minutes or even seconds depending on the risk of battery drain.

 

Presumably, when the power-off button is pressed, the device is actually off and not in some idle state? Or is there some stuff going on while it is "off"?

 

Thanks very much.

Please use plain text.
Developer
maadani
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: Device idle, power off, repeating background tasks

I'm not sure about the first part.

 

The device can go into idle mode even when background threads are running unless you specifically request to stay awake.

 

However, draining the battery can happen even if the device is in idle screen (for example, multiple connections).

 

Here are some ideas to improve battery consumption:

 

a. Code according to event - Listen to the events of the phone (battery changes, power charge, WIFI status, etc) and act accordingly. For example, shot down your application when battery reaches 29% and reactivate it when connecting to charger.

 

B. Set up different Configuration modes - For example, most people sleeps between 00:00 to 06:00. During that time, you can shot down your application and start it up a bit before. This way, most people would wake and your application would be up to date as if it worked all night long...

 

C. You talked about making frequent connections. Consider using the push service. This way you would make connections only when you really need to.

 

d. Move as much as possible processing to the server. The less work your application would do, it will consume less power.

 

Hope that helps,

 

E.

Please use plain text.
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: Device idle, power off, repeating background tasks

Yes, this is true: frequently repeating tasks will prevent the device from going into a low-power (standby) mode. It is not simply "idle" mode with the screen turned off - it is a deeper sleep, so to speak. Make sure you reschedule such tasks to some very low frequency (once in a few hours) when the application is not active and the screen is black. Schedule them at the regular intervals when the aplication become active again.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.
Contributor
magnetix
Posts: 41
Registered: ‎11-11-2010
My Device: Not Specified

Re: Device idle, power off, repeating background tasks

This confirms what I'd read - it would be nice if there was some article or guide that would explain fully how it works and the timings involved.

 

My own app will not be making connections as such, but polling for data-usage on the device. I ran a test last night doing persistent store commits every 5 seconds and the battery drain was the same as another handset. So I think it's ok for now. In my final product, the frequency will be lower than once per 5 secs - it was just a test. There may be a way I can make the polling frequency more intelligent later on, but data/byte usage could happen at any time while the device is on unfortunately.

 

Thanks to you both for the info.

Please use plain text.