This document discusses various techniques to optimize mobile apps for battery performance. It suggests reducing unnecessary background activities, deferring tasks until the phone is charging, batching network requests, limiting location updates and syncing, adjusting for connection type and charge level, and using tools like Battery Historian to monitor battery usage and identify areas for improvement. The overall message is that optimizing for battery life requires understanding how power is consumed and making strategic tradeoffs between features, performance and energy efficiency.
8. ..and this is what it should ends like
20-30% Core Functions
70% ADs, GPS, Analytics
Reduce the Battery
Consumption
9. Where does the power go?
CPU RADIOS SCREEN
Screen OFF
e.g. wakelocks e.g. syncs, n/w
activities
Background
Activities
Screen ON
10. Design Principal
Reduce Defer Coalesce
Say Minimum/ lesser
background activities
If required, defer
it to when the
phone is
plugged in
Coalesce it with
other activities to
reduce wakeup
overhead
12. Doze ( Android N)
Significant Motion Detector is needed for tracking
13. App Standby
System determines the state of an app is idle when the user is not actively using it. It
understands the app that is not being touched but also takes into consideration that NONE of
these should imply:
The user explicitly launches the app.
The app has a process currently in the foreground (either as an activity or foreground
service, or in use by another activity or foreground service).
The app generates a notification that users see on the lock screen or in the
notification tray.
20. Do Less,When You Can
Do you really need GPS?
Approximation?
Ask the User Carry On
YesNo
YesNo
You are Safe!
Use Proximation in Action to reduce the resource usage
Less time, Less process results but still meeting userâs needs
Approximation of Pixels
27. Say âByeâ to Polling
New News?
No
New News?
No
New News?
No
New News available
OK
28. Prefetch Data
A way to avoid number of independent data transfer sessions
Allows user to download all the data in a given period in a single burst &
connection, at full capacity. Reduces radio activations and bandwidth, improves
battery life and latency. e.g Music Player, News reader
29. Batch Transfer & Connections
Bundle your data transfers and create a pending transfer queue
Transfer as much data as possible during each transfer session to limit the
number of sessions you require
30. Care about Network State
WiFi will be fast and Cheap - give priority
Avoid connections if NO Network is available.
Manipulate Broadcast receivers on demand
Are you on Roaming?
31. Varying Download pattern
Modify the pattern based on connection type.Also, think behaviour type
Download more data per session on faster networks
..but involve user in this scene
Force a quicker pre-fetch
32. Monitor Charge Level & State
Dock Types
Car Desk
Low-End
(Analog) Desk
High-End
(Digital) Desk
Maximise app updates and its frequency when battery is charging
Avoid updates when charge state is discharging
Opt to update the frequency of update when charged with desktop dock
than car dock
37. Gather Insight Action
Use the tools that help
you gather the
information - GPU,
CPU or Battery Usage
What it means, and
how it will impact your
program
Act on it and repeat!
1
2
3
The
LifecycleUnderstanding which
tool to use, to
understand what data
and then where to
look into the code