sockets - Why does my Android application drain battery? -


i've written simple application displays text , little bit of graphics on screen. i'm using nexus 7, installation, , such needs on continuously as 12 hours day. however, despite being plugged in , charging, application drains battery in 8 hours (10-15% / hour).

apart infrequently-changing text , graphics, application 2 things:

it keeps screen on, @ full brightness (via windowmanager.layoutparams.flag_keep_screen_on); and

it opens 2 datagramsockets, 1 act udp client, , 1 act udp server. these sockets both opened automatically , managed library i'm using, oscp5. it's open source, can hack needed, though less better. (kiss.)

i've tested nexus 7 battery life no apps running, screen @ full brightness, tickle every 29 minutes keep sleeping, few hours no battery drain @ all. so, signs seem point sockets. don't have frequent communication on sockets, receive approximately few kb every minute (based on user interaction part of installation).

is there can do, sockets, or other general testing, minimize or eliminate battery drain? need through 12 hours, keeping full charge while plugged in doesn't seem should such tall order...

however, despite being plugged in , charging, application drains battery in 8 hours (10-15% / hour).

what have nexus 7 plugged into? think can take advantage of high-speed charging usb port, kind need tablets (android + ipad). see results being more if have plugged garden-variety usb port.

so, signs seem point sockets.

they're candidate, though since wifi radio on while device charging anyway, i'd bit surprised. me, feels cpu issue, you're busy-waiting or rather blocking.

is there can do, sockets, or other general testing, minimize or eliminate battery drain?

i'd see if traceview points out you're consuming lots of cpu time. i'd investigate charging port issue. i'd modify app mock socket work , try see if problem persists -- if does, issue isn't sockets.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -