eNotify & Battery
I've had some queries recently about the battery usage in eNotify Lite. This article answers the following 2 questions:
1. Does eNotify cause battery drain?. The answer is NO, but will take some explanation :) Regularly checking for emails on a server is an inherently expensive task. However, eNotify tries to do this in smart way to reduce battery and data consumption.
2. What can I do to make eNotify use less Battery? Answers below.
Polling vs Push Email:
Polling means to check the server for mail at a specified interval. In eNotify, you have a "Check Interval" with values from "Every Minute" up to "Every Hour". Obviously, polling every minute is more expensive than polling every hour. However, it isn't due to the network traffic or the processing power required to scan the emails. The main problem is that it requires the device to wake up frequently. Mobile devices conserve energy by periodically going into deep sleeps. However, if you disturb the device every minute then it will use more battery.
Push Email in eNotify can be accomplished by using IMAP-idle. IMAP-IDLE as described by About.com:
IMAP IDLE is an optional expansion of the IMAP email accessing protocol that allows the server to send new message updates to the client in real time.
eNotfiy:
https://play.google.com/store/apps/details?id=com.hermes.enotifylite
eNotify Queries:
android_support @ verietassoftware.com
Glen Cook:
http://ewhizmobile.com/
Instead of having your email program check for new mail every few minutes, IMAP IDLE allows the server to notify your email program when new messages have arrived. You can see incoming mail immediately.
IDLE is implemented by maintaining a permanent connection to the mail server. Is this expensive in eNotify? No, by default we do not hold the device awake while idling. However, you can force the device to stay awake by selecting accounts -> [your account] -> Advanced -> Wake Lock -> On
What is a Wake Lock? eNotify periodically uses "partial" Wake Locks to keep the device awake during email scanning. A partial wake-lock lets the screen sleep, but keeps the CPU active. In human terms, it stops the device sleeping on the job! :)
FACTS:
The following data comes from one of our users Eric Moore. He initially contacted me about a separate issue, but our correspondence ended up leading to a detailed investigate of the battery characteristics of eNoitfy. I've quoted Eric here with his permission:
Eric writes:
I am not having any problem with battery drain. I use BetterBatteryStats to measure battery drain.
Before installing eNotify, my battery drain night was typically between 1.1% and 1.5 % per hour (then my email app, the stock Samsung email app was polling once an hour at night). I’ve also used [app name removed] (which is imap push) and also got battery drain in the same range.
Last night, with enNotify running, my drain was 1.1% per hour. It has been around there every night since have I’ve had it installed (about a week now). My battery drain, with use, during the day seems to be what is was before. I am pretty happy with that...
According to BetterBatteryStats, over the last 4 and a half hours, eNotify has taken 742 partial wake locks for a total of 21 seconds. It is not even in the 10 of all my processes for time in partial wakelocks.
Fyi, Before trying eNotify, I tried an app called [name removed]. With that app my battery drain at night was about 3.5% per hour.
So I’m getting my email notifications instantly, with no perceptible impact on the battery!
2 Accounts: IMAP IDLE and 1 minute interval:
Yes. One imap-idle account and one gmail account.
My device is going into deep sleep 60% to 90% of the time according to both BetterBatteryStats and CPU Spy.
Compared against email App:
when I used [named removed] mail (with IMAP push), I got deep sleep percentages of 60% - 90%,
also, same as with eNotify.
2 Accounts: Both using 1 minute interval:
As you requested. Here is a output from BetterBatteryStats, with one
minute polling, after 1 hour and 6 minutes. I had both my imap account
and gmail accounts set for one minute polling. (Maybe the AlarmManager
entry corresponds to one poll per minute for 66 minutes (?).)
The battery drained about 2% over an hour.
big THANK YOU to Eric for running these tests.
In conclusion, eNotify handles the battery especially well for an app with a challenging mission.
eNotify Lite: What's the difference?
There must be some problems, right? YES. I cannot hide form what I've done! :) It came to my attention recently that eNotify-Lite does have an issue with battery drain. The two versions (Lite and Full) are nearly identical however eNotify-Lite serves ads with the mopub advertising library. Why is this an issue? Well these wee little beasties apart from being annoying are also implemented using javascript or in some cases flash. To render these ads require additional browser threads and screen updates. This is compounded by the fact that some Android devices are not very clever about shutting down browser threads.
For users that keep their screens on frequently, the 'movement' in the ads [Browser threads] can cause battery drain...In 1.97, I added code to remove any dynamic ads after a period of time this greatly reduces the battery usage.. I've also replaced mopub with Google admob. The presentation and resource utilization is much better in AdMob which isn't surprising given their tight integration with Google.
eNotify Lite Tests, Conditions:
- HTC ONE V (Ice cream sandwich)
- One gmail account idling
- Screen set to ALWAYS ON
- Pop-up dialog permanently open
- 2 Hours
eNotify not installed: 2 Hours: 23% drain
eNotify Full Version (pre 1.97): 24% drain
eNotify-Lite (pre 1.97): 31% drain
eNotify 1.97: 24% drain
I'm not sure the small percentages mean anything...It could just be rounding errors in my trial.
I'm not sure the small percentages mean anything...It could just be rounding errors in my trial.
WHAT SETTINGS CAN HELP?
As Eric's data hows, eNotify uses the battery well in spite of being given a challenging task -> Contacting the mail server frequently to check for new messages.
But the following options can help you squeeze more battery out:
WIFI Sleep Policy:
Keeping the WIFI radio on [sleep policy: Never] is not an issue in isolation. The problem arises when you're walking around with your device. The OS will constantly be scanning for new WIFI hot spots trying to make a connection. This will wear down the battery eventually. So you're better off selecting a less aggressive policy such as "After 15 minutes".
Check Interval:
If eNotfiy checks the server frequently it will use more battery (and data). Checking every "30 minutes" or "Every Hour" will use negligible battery [Meaning you won't even be able to measure what eNotify is using compared to other apps].. But as Eric's tests showed above, he scanned 2 accounts every minute for 1 hour and it only used about 2% of the battery.
Screen:
The biggest impact on battery life is your screen sleep time. eNotify never sets anything to keep your screen alive. It is solely determine by your device settings.
Keep in mind that eNotify Lite [and other free apps] do serve ads. Those ads will cause screen refreshes which consumes some battery. However, as mentioned above eNotify-Lite now aggressively removes ads and uses in addition to using an efficient network It would expect battery usage form ads to be lower in eNotify Lite as compared to other apps.
Wake Locks:
Wake Locks keep the device CPU alive long enough to scan the mail accounts. You can turn wake-locks off in the Advanced menu on the account edit screen. However, if you do this there is no guarantee that eNotify will wake up and notify you of messages. So you'll be sacrificing reliability to gain some battery savings.
I may add a few more settings to let power users control the battery usage:
1. Ability to switch polling intervals when battery is low [1 minute to 30 minutes for example]
2. Ability to turn polling off when battery is low
3. Advanced menu control over some of the settings like the retrying failed connections
4. Advanced control over a component called the AlarmManager that wakes up the application when it is time to scan the accounts
None of these are particular difficult to do, but it isn't clear that they are necessary. Introducing a battery plan suggests that eNotify is battery intensive and may cause panic, but the only test results I've seen seem to suggest it isn't an issue.
I do like the idea of features 1 and 2, but I need to do additional testing to see if they will make any meaningful difference.
THE FUTURE?
1. Ability to switch polling intervals when battery is low [1 minute to 30 minutes for example]
2. Ability to turn polling off when battery is low
3. Advanced menu control over some of the settings like the retrying failed connections
4. Advanced control over a component called the AlarmManager that wakes up the application when it is time to scan the accounts
None of these are particular difficult to do, but it isn't clear that they are necessary. Introducing a battery plan suggests that eNotify is battery intensive and may cause panic, but the only test results I've seen seem to suggest it isn't an issue.
I do like the idea of features 1 and 2, but I need to do additional testing to see if they will make any meaningful difference.
eNotfiy:
https://play.google.com/store/apps/details?id=com.hermes.enotifylite
eNotify Queries:
android_support @ verietassoftware.com
Glen Cook:
http://ewhizmobile.com/
No comments:
Post a Comment