The talk is about the “Best Practices” after the mistakes we learnt from.
This is a series of the most interesting “epic fails” we did and hard lessons we learnt. In this session, we will share some stories on how the most unexpected tiny error had the biggest impact.
http://2015.droidcon.gr/session/raymond-chenon/
2. App Fails and Retrospectives
#Session SDK
Raymond Chenon
google.com/+RaymondChenon
3. Topics
1. Zalando
2. Our Google Play Release Panic
3. An Internationalization Problem
4. User Country Problem
5. App Deep Link
6. Choosing a library
4. One of Europe's largest online fashion retailers
15 countries
3 fulfillment centers
16+ million active customers
2.2+ billion € revenue 2014
9.000+ employees
5. About Zalando Tech
● Tech HQ in Berlin
● Four other tech offices, including Helsinki and Dublin
● +800 technologists
● Nearly everything produced in-house
● 135+ million visits per month (57% come from mobile
devices)
9. Play Store Release: The Context
After one week of testing and bugfixing:
100% Tests OK. QA team gave the go
The new app version was staged rollout at 50% of
our users right before a long weekend.
10. Chronology
● 19h We noticed all app start will crash after an
update.
● Issue escalated. Boss arrived .
● Call to Google. Sorry Google cannot revert for
you.
○ hotfix ( identify the cause first )
○ create a new .apk
11.
12. What Google says
Note that rollbacks aren’t supported due to the app versioning
requirements of the Android platform.If you need to rollback,
consider launching a previous APK with a new version number.
13. Understand App Versioning
Make sure that each successive release of your application
uses a greater versionCode value.
NewVersion.versionCode < Rollback.versionCode
versionCode
201 202 203
15. Rollback Strategy
versionCode
(internal)
2.3 (Old version) 2.4 (New version) 2.3.1 (Rollback)
versionName
( String visible to user)
101 102100
Rollback is built
from the code base
of the Old Version
16. Play Store Release: Lessons
- Cause of the crash : One column was renamed in the app’s
SQLite database
- Always test an app upgrade
- Have a rollback .apk ready
- Never publish before weekends or public holidays
- Limit the potential damage by starting the staged rollout
19. How this would work on iOS
- No staged rollout
- No app rollback strategy
- Expedited App Review ( Urgent Bug Fix ) takes
minimum 19 h ( without rejection)
21. When to celebrate a Release
Celebrate on the release day OR
after user reviews
Celebrate a release one week after .
It depends on the length of release cycle ( 6 week
cycle )
24. Internationalization
Why “Barcode
Scanner?”
● We use libraries with
resources: apklib, aar
● The apklib, aar library
overrides our strings
app_name library’s app_name
en zalando barcode scanner
de zalando barcode scanner
ru barcode scanner
25. Internationalization: Lang
The locales (res/values-xx/strings.xml) are two-
letter ISO 639-1 language
26^2 = 676 possibilities
You don’t have to cover all languages
29. User Country: The Context
Device locale is NOT the same as the country
where the user lives ( country of delivery )
● Example: My phone is in English, but I live in Greece
31. Solution IP geolocation
You can resolve with IP geolocation.
But there are some edge cases ,
the user :
- is roaming
- lives in a country border
32. Solution IP geolocation
You can resolve with IP geolocation.
But there are some edge cases ,
the user :
- is roaming
- lives in a country border
- uses a VPN
33. User Country: Solution 1
Mobile: you infer the user’s country by using the
TelephonyManager
import android.telephony.TelephonyManager;
….
telephonyManager.getNetworkCountryIso();
36. App Deep Link
App deep linking refers to a URL that points to a
specific part of an app ( onboarding )
Use cases
1. Link Web to App
2. Link App to App
3. Push Notifications , Ad Campaigns , Referral Programs ...
38. Error with deep links from developers
The application syncs data at initial setup phase.
Loading with a Splash screen.
Splash is the entry point for all target Activities.
Don’t forget to load the Splash.
39. Error with deep links
Take care how the deep links are used (
onboarding , home )
Create a good documentation.
Deep Links are powerful API.
Check how a third party would use them.
42. Criteria
1. Is the API to your liking?
2. Maturity level
3. How well documented is the project?
4. Is the project "famous"?
43. Select Your Library: Lessons
What is best for X may not be
for you. Do you own research.
- Always benchmark the
available libraries
- Don’t let fanboy/girlism
cloud your judgment
Libraries memory
use
loading
time ...
Picasso
Glide
Ion
Universal
Image
Loader
Volley
44. Refactoring: Some Best Practices
DO
1. no behavior change (100% unit tests success)
2. measurable improvement—strengthen the argument for
refactoring
DON’T
1. refactor without a set of tests in place
45. from Roboguice to Dagger 2
The library of Dependency Injection was good at
that time.
Now something new came out. It made its proof.
Cannot be incremental refactoring .
Must be done in one Go.
46. Arguments to switch from Roboguice to Dagger 2
Roboguice uses reflection ( runtime )
Dagger 2 is based annotation processing ( compile
time )
Performance-wise : Dagger 2 is much better than
Roboguice
47. Big Refactoring: Lessons
● The better you prepare for changes, the fewer
problems afterward
● Make sure everything compiles.
48. will take a
photo in
Greece
Raymond Chenon
google.com/+RaymondChenon
twitter.com/raychenon
raychenon.com
Thank you!
droidcon Greece Thessaloniki