Skip to Content
author's profile photo Former Member
Former Member

Background service eating up the device battery - Android platform

Hi everybody,

When the SUP server is unreachable (the connection times out), I've set the application to work in off-line mode, that is, initializing the application with the following code:

Application app = Application.getInstance();

if (app.getApplicationIdentifier() == null) app.setApplicationIdentifier("identifier");

app.setApplicationContext(getApplicationContext());

This way, I'm able to call the MBO operations without connecting with the SUP server.

But then, analyzing the application logs, I've noticed that a background service was started (probably by the SUP API) and tries to connect to the SUP server.

The problem is that the interval between each try, is only a few seconds, this is eating up the device's battery. There is a way to increase this interval?

Thanks in advance!

Best regards,

Danilo

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jul 27, 2012 at 03:51 PM

    Hi, Danilo.

    We got the following answer from Dirk Olderdissen in the internal forum. I really think you don't need to be worried about that, since this interval grows exponetially.

    Regards,

    Daniel Silva

    ------------------------------------------------

    To me this looks like works as designed. But maybe the R&D guys can confirm me being right/wrong :-)

    The MOCA component in the log you posted is the messaging engine, trying to establish a connection pipe with the SUP server. Over this connection pipe new message notifications etc are delivered to the device.

    In the past, the established procedure was to extend the duration between each connection attempt over time, to prevent the battery from draining, but still being able to re-establish the connection automatically without end user intervention. And, the log proves that the engine does that: The engine does three consecutive connection attempts every 20 secs. Then waits some time. This time delay is extended with every connection attempt triplet.

    From the log:

    MocaClient connection status changed: WAITING_TO_CONNECT delay = 160  MocaClient connection status changed: WAITING_TO_CONNECT delay = 320  MocaClient connection status changed: WAITING_TO_CONNECT delay = 640  

    This procedure has proved itself to be fairly efficient over time (and it has been around longer than Android), so I expect you do not need to be worried about unnecessary power consumption.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.