views:

105

answers:

2

Has anyone else noticed behavior specific to the HTC Incredible that might result in an app keeping the device awake and busy? I've received reports that my app is responsible for keeping the device awake and draining the battery, but only from HTC Incredible users.

My app responds to a number of Intents that might be related. It has a service that starts on boot, and it also responds to changes in network connectivity. I do use a WakeLock, but I'm careful to release it when I'm done processing, and the WakeLock times out after a couple minutes whether I'm done or not.

I've heard that the Incredible may have some connectivity problems, or that some of them do. Could it be that the network is going up and down frequently, triggering my app?

Any other ideas? I've asked a user to send me their logs with aLogCat. If they're willing, that may help narrow down the cause.

+1  A: 

If network changes frequently you gonna be running a lot.
Are you shutting your service down? Is your service running on worker thread ( by default it's not ). Do you need to respond to network changes while device is asleep ? Btw - running on boot - you'll probably will have second run after on boot as soon as radios are up on network change. Put some logs and see how many times you're actually run after the reboot.

Alex Volovoy
A: 

The problem seemed to be that I was getting very rapid network connectivity change Intents. Many more than I've ever seen with my Droid. I think I'm going to have to set a timed alarm on network connectivity changes so that I only try processing when the network has been stable for a certain amount of time.

I also found a situation where my code could fail to release the wake lock after rapid network state changes. The wake lock was still timing out, but by then, I had often received more network status changes.

I've fixed the latter problem, and in the meantime, I've turned off the Network status Intents for my app, since they're not crucial.

BenTobin
Please post stuff as comments or edits to the original question. New posts are only for answers. I tried to fix this for you, but turns out I can't delete posts, only edit them...
Chinmay Kanchi
I thought I was answering my own question. Isn't that what the "Answer your question" is for? I would have marked it as such, but it requires me to wait two days before doing so.
BenTobin