android - AlarmManager or Broadcast receiver battery widget -
which solution better battery widget. broadcast receiver or alarmmanager trigered every 5 minutes?
that depends upon definition of "better".
you cannot register action_battery_changed
broadcasts manifest, have have service running all time manages dynamically-registered receiver broadcast. many users dislike this.
alarmmanager
avoids need continuously-running service, mean app widget lag bit on finding out of battery level changes. however, allow user control polling frequency, via sharedpreference
, rather hard-coding 5 minutes. way, user in control on how cpu/battery consumed app polling, , therefore in control on how lag there be.
Comments
Post a Comment