Upload
dicoding
View
878
Download
3
Embed Size (px)
Citation preview
Building for theNext Billion
Users
Sidiq Permana
Google Developer Expert and Intel Android Software Innovator
TechMagician at Nusantara Beta Studio
ID-Android Developer Tech Talk #4
Malang, April 2 2016
1.4 Bilion+ Active Android Users
400 OEMs and 500 Carriers
Able to sell your app in 130 Countries
Disribute to 190+ Countries
65 Countries that you can tailor your app
pricing
Data source: GSMA https://gsmaintelligence.com/metrics/1/0/data/?report=535ac4dab8137
Internet penetration per country: ITU Measuring the Information Society http://www.itu.int/en/ITU-D/Statistics/Pages/publications/anapub.aspx
1 billion new users are expected to come online by 2017,
mostly from emerging market
D
World Bank country GDP classification: http://data.worldbank.org/about/country-and-lending-groups Human development index: http://hdr.undp.org/en/countries
Socio-economic statistics: www.gapminder.org
OECD countries: www.oecd.org
78% of the world’s population lives in emerging markets
(5.7 billion people)
It’s a Different Ballgame
● Slow and Expensive Internet
● Prepaid is used by >95% of users
● Mobile first
Top 11 Best Practices:Building for the next Billion Users*
* Also the last billion, and the billion after the next
Reducing Perceived Latency
● Every UI action should have an immediate visible reaction
○ Hide/show views, scrolling views, state changes
● Every touchable item should have touch feedback
○ Use touch ripple from android 5.0+
Material: Responsive Design
goo.gl/zMDilf
● Material design guidelines an extensive multi-year effort
● Make user intuitively know how to use your app
● Adaptive design methodology
Material Design Spec
google.com/design/spec
Prefetch Content
Anticipate what content your users may want
and have it ready
Take advantage of good device state, be
conservative instead
Prefetch Content
Use JobScheduler for Android 5.0+
There are alternatives for Android < 5.0:
● Android Job by Evernote
● GCM Network Manager
Using Job Scheduler
goo.gl/nK8X8g
Be smart about mobile data usage
Mobile Data mostly hast monthly quota and
cost real money
Smartphones aren’t as smart without
mobile data
Be smart about mobile data usage
Mobile Data mostly hast monthly quota and
cost real money
Smartphones aren’t as smart without
mobile data
Managing Network Usage
goo.gl/AZA23R
What is WebP?
● Open Source
● Support lossy and lossless format
● Supported Natively on Android since 4.0 and with Lossless Format since
4.2; Supported in Chrome and Opera
● 24-34% better compression than JPEG; 28% better than PNG with little to
no loss in visible quality
Why WebP?
● Reduce network usage
● Reduce bundled image asset sizes in your app/game for faster installs and
updates
● Downside is encoding and hosting multiple formats
WebP for developers
goo.gl/laQtI4
Put your APK on diet
APK size matters
Google Play smart app updates can help
Avoid users turning off auto-updates
Put your APK on diet
● Choose drawable assets carefully
○ Remember assets scaled down look OK but not the reverse
● Launcher icons include up to xxxhdpi
○ Store in mipmap- directories (eg. mipmap-hdpi)
● Remove unused code and resources
○ minifyEnabled=true
○ shrinkResources=true
● Multiple APK an option but has tradeoffs
Keep graphics performance smooth
Aim for 60fps, this allows for ~16ms per frame
(1000/60)
Reduce “actual latency” - easier said than done
Keep graphics performance smooth
● Minimize layout overdraw and layout depth
● Only run UI updates and logic on the UI thread
● Memory allocations can cause GC
○ Images often to blame - use a library like Glide or Picasso
● Use on-device tools: GPU profiling and overdraw
Performance patterns video series
goo.gl/3dBbse
Reduce Battery Usage
● Avoid holdingWakeLocks directly
○ Use FLAG_KEEP_SCREEN_ON and WakefulBroadcastReceiver
● Use the new JobScheduler API in Android 5.0+
● Batch network transfers and connections
● User facing battery blaming and new developer tooling
Keeping the device awake
goo.gl/EQVB0i
Reduce Memory Usage
Avoid long running services -
be a good citizen
More background memory
usage leads to slower
multitasking and less system
efficiency
Reduce Memory Usage
● Subclass IntentService not Service
● Let the system wake you
○ GCM, JobScheduler,AlarmManager or other system events
● ActivityManager.isLowRamDevice()
○ ~512MB with 800x480 or less screen
● Process stats and new memory monitor
App Architecture
The right app architecture can dramatically improve the user
experience
Optimize for fast, responsive UI that is not tied to long running
operations like networkrequests
Google I/O 2014 App
github.com/google/iosched
App Architecture
● Ensure identical network requests are never duplicated
○ Use a local database for long lived data
○ Use a bounded disk cache for transitory data
● Screens should still be navigable even if network is down
● Never block the UI due to a long running operation
○ Use inline loading spinners if needed
○ Use AsyncTask but only for UI related background operations
Three common problems
• It can be difficult to integrate new features as you are worried about compatibility
with the existing system.
• Time is spent fixing old code, which have developed mysterious bugs that are hard
to reproduce and to fix.
• You may have forgotten what a lot of the code does, and so you may be afraid that
touching it will break the system.
Good code is understandable
codeUnderstandable code is easier to maintain, easier for
new developers to learn, easier to debug, faster to find
what you're looking for, and most importantly: helps
that the programmers writing the code actually
understand business objectives.
Summary
11. Responsiveness 10. Material
Design
9. Anticipate
8. Smart Datausage 7. WebP 6. Put your APK ondiet
5. Smooth likebutter 4. Battery 3. Memory
2. AppArchitecture 1. Good Codes