java - Thread vs AlarmManager wich one has low battery usage -


what need in application stuff every 30 sec 18 hours per day want keep running device going sleep mode
found 2 ways:

  1. using timer using alarmmanager type of alarmmanager.elapsed_realtime_wakeup
  2. using thread unfinished while-loop , sleep thread every 30 seconds.

now using timers, works fine in api versions have 1 problem , that's battery usage.

my question is, can use thread instead of timers? heard somewhere threads cannot run long times (5sec max), i'm not sure.
, if can use thread, take lower power timers?
, works api versions?

here description of question http://www.vogella.com/tutorials/androidtaskscheduling/article.html


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -