Preparing your app for the next
billion internet users
Assaf Gelber
Droidcon Tel-Aviv 2017
Assaf Gelber
Facebook
Facebook Lite
You are all a very special
group of people
Kotlin VS API level 9
Why I'm here
• Convince you that you should care
• Explain why this is a hard problem
• Discuss high-level tips and directions
• Answer your questions
Agenda
• Why you should care
• Why it's hard
• What you can do about it
• Why you should care
• Why it's hard
• What you can do about it
Let's play a game!
• 1080x1920 pixel display
• 128 GB internal storage
• 4 GB RAM
• 8 core 2.35 GHz/1.9 GHz CPU
• $749
Google Pixel 2
Released: 2017
• 540x960 pixel display
• 16 GB internal storage
• 1 GB RAM
• 4 core 1.2 GHz CPU
• Around $250
Samsung Galaxy A3
Released: 2017
• 720x1280 pixel display
• 16 GB internal storage
• 2 GB RAM
• 4 core 1.3 GHz CPU
• Around $100
InFocus Turbo 5
Released: 2017
• 480x854 pixel display
• 4 GB internal storage
• 512 MB RAM
• 4 core 1.3 GHz CPU
• Around $42
Swipe Neo Power
Released: 2017
And they are here to stay
So how can we reason about
them?
Year class classification
In what year would this have
been a high-end device?
Google Pixel 2
Year class: 2015
Samsung Galaxy A3
Year class: 2011
InFocus Turbo 5
Year class: 2012
Swipe Neo Power
Year class: 2010
Let's look at data
Year class distribution in Africa
2009
2010
2011
2012
2013
2014
2015
Year class distribution in South America
2009
2010
2011
2012
2013
2014
2015
Year class distribution in Asia
2009
2010
2011
2012
2013
2014
2015
Year class distribution in Europe
2009
2010
2011
2012
2013
2014
2015
Year class distribution overall
2009
2010
2011
2012
2013
2014
2015
Over 50% of people worldwide
are on 2012 and under!
Let's look at networks
Percent of users on 2G networks
India
Africa
S. America
Middle East
Europe
N. America
77%
67%
38%
52%
26%
10%
Source: GSMA Intelligence - Global Mobile Trends 2017
36% are on 2G overall
Source: GSMA Intelligence - Global Mobile Trends 2017
But not all networks are
created equal
And not all data packages are
priced equal
Let's look at new users
Emerging markets will account
for over 90% of new mobile
subscribers globally by 2020
Source: GSMA Intelligence - Global Mobile Trends 2017
But do I reaaalllly need to
build for them?
Yes!
Yes! Well, kind of.
• Why you should care
• Why it's hard
• What you can do about it
• Old devices are old
• New devices are also old
Usage is completely different
• Turn off data when not in use
• Save content when on WiFi for later
• Install apps by sharing APKs over bluetooth
Design for new users
Let's play another game!
Round 2
Designing for new internet
users is hard
Designing for flaky networks
and devices is also hard
• Why you should care
• Why it's hard
• What you can do about it
One simple rule
1. Measure everything
Easy, right?
Allow me to expand
• APK size
• Storage and caches
• Runtime perf
• Network
Let's talk about Facebook Lite
Client ͍ Proxy ͍ Server
• Client connects to a proxy
• Proxy knows everything
• Proxy does everything
Client is very thin
• APK size
• Storage and caches
• Runtime perf
• Network
Quite easy to measure and
monitor
Important for a number of
reasons
• Mobile data availability
• Network failures
• Size on disk
Use these:
• ProGuard minification & dead code
• ReDex dex optimizing
• Resource shrinking
• Multiple APKs
Consider these:
• Vector drawables
• Downloadable fonts
• Alternative build systems
Facebook Lite?
Almost no resources in APK
No Optimizations 8.1 MB
With Optimizations 1.6 MB
• APK size
• Storage and caches
• Runtime perf
• Network
Measuring used to require ugly
hacks
StorageStatsManager solves
that in API 26 ¯_( )_/¯
Users are very aware of what is
on their device
• Make downloaded content easily clearable
• Be prepared for data to be cleared
• Sometimes server-side state makes sense
Facebook Lite?
• Proxy is aware of what the client saves
• Sends diffs when necessary
• Clears things that aren't necessary anymore
• APK size
• Storage and caches
• Runtime perf
• Network
Android GO!
Android Profiler is awesome
Systrace is awesome-er
Find the correct time to run
your code
Lazy loading is your friend
But not a silver bullet
Facebook Lite?
A lot of wins came from finding
the correct times to execute
• APK size
• Storage and caches
• Runtime perf
• Network
Measuring requires a bit of
effort
But it's possible
Usually easier from server
In most cases, images dominate
network traffic.
• Scale images to the required size
• Pick the correct image format
• Find the right time to send images
Size Weight
1280x960 325 KB
480x360 57 KB
82 percent less data!
Down to 36KB when converting
to high-quality WebP
Serialization is often
overlooked
• Don't use JSON
• Don't use JSON
• Don't use XML
Play around with network
situation emulators
Try Augmented Traffic Control if
you want more control
Facebook Lite?
• Very diligent about what we send
• Very diligent about when we send it
• Use custom protocol and compress it
Your mileage may vary, of
course
A
B
C
Always
Be
C Fine tuning
Be part of this growth and help
new internet users
Thank you!
Assaf Gelber
Droidcon Tel-Aviv 2017
Questions?
Assaf Gelber
Droidcon Tel-Aviv 2017

Preparing your app for the next billion internet users - Assaf Gelber, Facebook