SlideShare a Scribd company logo
1 of 69
Download to read offline
© Sean Katz
Best ANDROID
Development
Practices
1
© Sean Katz
Hello!
I AM SEAN KATZ
I love (Android) development
Hope you’ll love it too.
- Software Dev Manager @ Autodesk
- Previously Co-Founder @ for-each
- 10 Years work in software dev
- Passionate about Mobile & Web
- Father of Mini
2
© Sean Katz
SUBJECTS TODAY
1. Architecture
2. Gradle
3. Android Studio
4. Git
5. Manifest
6. APIs & Support Lib
7. App Code Skeletons
1. Boilerplate code
2. Performance
3. Debug & Measure
4. CI
5. Security
6. Graphical Design
3
© Sean Katz
What is Tipz.io ?
○ 2 in 1:
● Bite-Size Tips platform for acquiring skills
● Open Source Initiative for educational purposes
○ Contribute! Web, Android & iOS dev, DevOps, UX/UI work,
marketing, branding, SEO… show your skills on tipz!
○ Earn endless love & real-life reputation
4
© Sean Katz
Give a Star on GitHub!
5
1.
2.
3.
© Sean Katz
Tips on learning Tipz - browse tipz.io
6
© Sean Katz
Tips on learning Tipz - browse commits
7
© Sean Katz
Tips on learning Tipz - blame a file
8
© Sean Katz
Tips on learning Tipz - browse pull reqs
9
© Sean Katz
Tips on learning Tipz - continuously learn
10
© Sean Katz
Contributors gets backstage access
11
© Sean Katz
“
FULL BLOWN
ARCHITECTURE
Weeks of programming can save you
hours of planning
12
© Sean Katz
What is an Android app?
Choose one or more:
✓ Activity - display
❏ Service - do
❏ Content Provider - data
❏ Broadcast - communicate
13
© Sean Katz
PLAN ARCHITECTURE
ACTIVITY
(or FRAGMENT)
Viewable
Interactions
Foreground
SERVICE
Engine
BlackBox
Background
Network
Go Fetch content
Broadcast status
CONTENT
PROVIDER
Data
URIs
Encapsulation
Results?
Data CRUD
Sync
14
© Sean Katz
“
GRADLE
Computers are good at following instructions,
but not at reading your mind
- Donald Knuth
15
© Sean Katz
Hello: GRADLE
● Build system
○ Like Grunt
○ Forget ‘Ant’
● Groovy
● Terminal run
16
© Sean Katz
GRADLE Tipz
1. Always use a gradle wrapper ☞
2. Leverage a top-level build.gradle ☞
3. Set names to your modules ☞
4. Prefer a remote maven dependency ☞
5. Always choose dependencies explicitly ☞
6. Read the changelog of the Android Build
Tools ☞
17
© Sean Katz
“
ANDROID STUDIO
My favorite things in life don't cost any money.
It's really clear that the most precious resource
we all have is time
- Steve Jobs
18
© Sean Katz
Hello: ANDROID STUDIO
19
© Sean Katz
ANDROID STUDIO Tipz
1. Install plugins ☞
2. Color your logcat ☞
3. Use Android tools
4. Enforce code styles ☞
5. Inspect code + Lint
6. Know (and use) code templates ☞
20
© Sean Katz
“
GIT
Coming together is a beginning. Keeping
together is progress. Working together is
success
- Henry Ford
21
© Sean Katz
Hello: GIT
● Popular SCM
● Branch away
● Collaborate
● Code Review
● Open Source
22
© Sean Katz
Hello: GIT & SourceTree
23
© Sean Katz
Hello:
GIT flow
● Master
● Develop
● Feature/*
● Release/*
● Hotfix/*
24
© Sean Katz
GIT Tipz
1. Your git should hold all the files needed
to compile the project from scratch ☞
2. Always start with a gitignore file first ☞
3. Don't invent 'gitignore', Look for an
already published gitignore for various
use cases ☞
25
© Sean Katz
“The Internet is the first thing that humanity has
built that humanity doesn't understand, the
largest experiment in anarchy that we have ever
had
MANIFEST
- Eric Schmidt
26
© Sean Katz
Hello: MANIFEST
27
© Sean Katz
MANIFEST Tipz
1. Meet Android Dashboard ☞
2. Manifest's Package name vs build.
gradle's Application ID ☞
3. Carefully add new permissions ☞
4. Think About android:allowBackup ☞
5. Guard your components with android:
exported='false' ☞
28
© Sean Katz
“By failing to prepare, you are preparing to fail
ANDROID APIs &
SUPPORT LIBRARY
- Benjamin Franklin
29
© Sean Katz
ANDROID APIs
Code name Version API level
Lollipop 5.0 21
KitKat 4.4.x 19
Jelly Bean 4.1.x, 4.2.x, 4.3.x 16 - 18
Ice Cream Sandwich 4.0.3, 4.0.4 15
Ice Cream Sandwich 4.0.1, 4.0.2 14
Honeycomb 3.x 11-13
Froyo, Gingerbread 2.2.x - 2.3.x 8-10
Cupcake, Donut, Eclair 1.x - 2.1.x 1-7
Minimum API
< ~8% users
Target API
Compiled SDK
30
© Sean Katz
❤ SUPPORT LIBRARY
Corresponding Features from support API level
● getExternalStorageState
● Notification (additions - wear, car, ...)
21
● ConnectivityManager
● Notification (additions)
● Nested Fragments (v4) (issue)
16 - 18
● Fragment
● ActionBar, ActionBarDrawerToggle
● Material design, Toolbar
● ViewPager, FragmentPagerAdapter
● LocalBroadcastManager
● Loader
● Share, ShareActionProvider
● SearchView
● GridLayout
14
11-13
8-10
1-7
Minimum API
< ~8% users
Target API
Compiled SDK
31
© Sean Katz
❤ SUPPORT LIBRARY - standalones
Corresponding Features from support API level
● DrawerLayout
● SlidingPaneLayout
● PrintHelper
● SwipeRefreshLayout
● CardView
● RecyclerView
● Palette
● Multidex
Standalone
© Sean Katz
APIs & SUPPORT LIB Tipz
1. Always compile to the latest SDK ver ☞
2. Selecting the Android version you
support (minSdkVersion) ☞
3. Prefer Support Library over built in APIs
(even if your minimum API allows it) ☞
33
© Sean Katz
“Simplicity is the ultimate form of sophistication
APP CODE
SKELETONS
- Leonardo da Vinci
34
© Sean Katz
APPLICATION CLASS Tipz
1. Use Application class, don't abuse ☞
2. Don't use class as a single tone ☞
3. Don't do lengthy operations ☞
4. Assume the Application class values
never gets deleted ☞
35
© Sean Katz
LIFECYCLE Tipz
1. Create a Launcher Activity ☞
2. A runtime check for version upgrade ☞
3. If you need to know when your Activity is
in resume mode ☞
4. Fragments are automatically recreated
upon Activity re-create ☞
5. Pick your Fragment: Static or Dynamic ☞
36
© Sean Katz
SERVICES, PROVIDERS & DB Tipz
1. Provide an easy instantiation to your
component ☞
2. DB operations are heavy ☞
3. You probably should use IntentService ☞
37
© Sean Katz
SHARED PREFS Tipz
https://github.com/tipz/tipz-android/pull/1/
1. Shared Preference commit() is not the
only option
2. Smartly organized SharedPreferences
3. Do not store secrets in the Shared
Preferences (+ encryption example)
38
© Sean Katz
GENERAL CODE Tipz
1. Adapter view data is always there ☞
2. Keep your logs tidy ☞
3. Goodbye old List/Grid and Adapters,
Hello RecyclerView ☞
4. Request Resources and not Context ☞
5. When in need of debug sections, use
BuildConfig.DEBUG ☞
39
© Sean Katz
“Measuring programming progress by lines of
code is like measuring aircraft building progress
by weight
BOILERPLATE
CODE
- Bill Gates
40
© Sean Katz
Hello: BOILERPLATE CODE
○ BaseFragment - tag, debug, inflate
○ BaseLoadingFragment - progress views
○ BaseDataFragment - connects to data
○ BaseDataAdapterFragment - w/ adapter
○ BaseDataAdapterPagingFragment
○ Service
○ IntentService - off-the-ui-thread, queue
○ WakefulIntentService - stays awake
○ BaseService - broadcasts, access ease
○ ContentService - provider, REST api’s
41
© Sean Katz
BOILERPLATE Samplez
1. “Copy and paste is a design error”
2. BaseDataFragment ☞
3. RecyclerViewAdapter ☞
4. BaseContentProvider (+DB) ☞
5. BaseActivity ☞
42
© Sean Katz
“It's hardware that makes a machine fast. It's
software that makes a fast machine slow
PERFORMANCE
- Craig Bruce
43
© Sean Katz
1. Context and memory leaks ☞
2. Avoid Internal Getters/Setters ☞
3. Minimize view hierarchies
4. Don’t overdraw
5. Let the pros handle images ☞
6. Bulk/Transactional inserts are faster ☞
PERFORMANCE Tipz
44
© Sean Katz
“Debugging is twice as hard as writing the code
in the first place. Therefore, if you write the code
as cleverly as possible, you are, by definition, not
smart enough to debug it.
DEBUG &
MEASURE TOOLS
- Brian Kernighan
45
© Sean Katz
StrictMode
46
Or, Report to logcat ☞
Activate in developer tools
© Sean Katz
GPU Overdraw
47
No color 0X
Blue 1X
Green 2X
Light Red 3X
Dark Red 4X +
© Sean Katz
Profile GPU Rendering
48
Blue Draw (Java)
Red Process (Render)
Orange Execute (Pipeline)
Green 60 FPS target
© Sean Katz
Don’t keep activities
49
© Sean Katz
Show Layout Bounds (Developer tools)
50
© Sean Katz
Show Layout Bounds (Android Device Monitor)
51
© Sean Katz
Network Statistics
52
Tag network using:
android.net.TrafficStats
© Sean Katz
Method Tracing
53
© Sean Katz
Java Heap + MAT
54
© Sean Katz
System Information
1. Activity Manager State
2. Package Information
3. Memory Usage
4. Memory use over time
5. Graphics State
55
© Sean Katz
“An iPod, a phone, an internet mobile
communicator... these are NOT three separate
devices! And we are calling it iPhone! Today
Apple is going to reinvent the phone
Continuous
Integration
- Steve Jobs
56
© Sean Katz
Hello: CI
● Automation
○ Trigger
○ Build
○ Test
○ Deploy
● Tools
○ Jenkins
○ ship.io (SaaS)
57
© Sean Katz
CI Tipz
1. Use a version numbering scheme ☞
2. Automated versioning ☞
3. Store your debug key in git ☞
58
© Sean Katz
“The only truly secure system is one that is
powered off, cast in a block of concrete and
sealed in a lead-lined room with armed guards
SECURITY
– Gene Spafford
59
© Sean Katz
SECURITY Tipz
1. Use proguard (see next slide)
2. Silent the logs ☞
3. Do not store secrets in storage ☞
4. Run Android Lint for security checks
5. android:exported='false' ☞
6. Safe keep Production signing key ☞
60
© Sean Katz
PROGUARD Tipz
1. Proguard your release, not debug ☞
2. What's in the stock Android proguard ☞
3. Run Proguard on a frequent basis ☞
4. Create separate proguard files ☞
5. Planning on using json parsers? ☞
6. Proguard for 3rd party libraries ☞
61
© Sean Katz
REVERSE ENGINEERING Tipz
1. Reverse own app for security checkup
2. Steps:
a. Rename app.APK to app.ZIP
b. extract app.ZIP
c. classes.dex -> jar (tool)
3. Output:
a. Java files: jar -> clear text java (tool)
b. Resources: Folder “res” with the resources
62
© Sean Katz
“There is no reason anyone would want a
computer in their home
GRAPHICAL
DESIGN
- Ken Olson, 1977
63
© Sean Katz
Android Design Cheat-Sheet
64
http://possiblemobile.com/wp-content/uploads/2014/01/Android-Design-Cheat-Sheet-highres.png
© Sean Katz
PRODUCTIVE TEAMWORK
1. Productive Teamwork Blog Post ☞
a. Understanding the different configurations
b. Planning a dynamic layout
c. Real estate of the screen
d. Stretching techniques (9 patch)
e. Full screen images
f. Folder and Files naming conventions
g. Marketing (Google Play) assets
65
© Sean Katz
RESOURCES Tipz
1. Naming conventions for your ID's ☞
2. You can use '@null' in attributes values ☞
3. Carefully use platform drawables:
'@android:drawable/...' ☞
4. Custom attributes should use res-auto
xmlns ☞
5. Re-use XML layouts with <include.../> ☞
66
© Sean Katz
GENERAL GRAPHICAL Tipz
1. Prefer Toolbar over ActionBar ☞
2. Hello CardView ☞
3. Use AppCompat themes ☞
4. Styles, Themes and dimens = CSS ? ☞
67
© Sean Katz
THANKS!
Any questions?
68
blog.android-develop.com
@_SeanKatz
sean.katz@gmail.com
www.linkedin.com/in/seankatz
© Sean Katz
Line Icons by Webalys, Virgil Pana and Mirko Monti are published under a Creative Commons Attribution license and Free for both personal and
commercial use. You can copy, adapt, remix, distribute or transmit them. If you use these sets on your presentation remember to keep the “Credits” slide
or provide a mention and link to these resources:
● Mirko Monti - Simple line icons
● Virgil Pana - E-commerce icons
● Webalys - Streamline iconset 69
ASSETS CREDITS

More Related Content

What's hot

What's new in Android at I/O'16
What's new in Android at I/O'16What's new in Android at I/O'16
What's new in Android at I/O'16Elif Boncuk
 
GWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 PanicGWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 PanicCristiano Costantini
 
Intro to Gradle + How to get up to speed
Intro to Gradle + How to get up to speedIntro to Gradle + How to get up to speed
Intro to Gradle + How to get up to speedReid Baker
 
Hack'n Break Android Workshop
Hack'n Break Android WorkshopHack'n Break Android Workshop
Hack'n Break Android WorkshopElif Boncuk
 
Predictable Web Apps with Angular and Redux
Predictable Web Apps with Angular and ReduxPredictable Web Apps with Angular and Redux
Predictable Web Apps with Angular and ReduxFITC
 
Fastlane for Androidによる継続的デリバリー
Fastlane for Androidによる継続的デリバリーFastlane for Androidによる継続的デリバリー
Fastlane for Androidによる継続的デリバリーFumiya Nakamura
 
WordCamp LA 2014- Writing Code that Scales
WordCamp LA 2014-  Writing Code that ScalesWordCamp LA 2014-  Writing Code that Scales
WordCamp LA 2014- Writing Code that ScalesSpectrOMTech.com
 
Gradle & Android Studio - Introduction
Gradle & Android Studio - IntroductionGradle & Android Studio - Introduction
Gradle & Android Studio - IntroductionKevin Pelgrims
 
Intro to Flutter SDK
Intro to Flutter SDKIntro to Flutter SDK
Intro to Flutter SDKdigitaljoni
 
Effective Android Development. UA Mobile 2016.
Effective Android Development. UA Mobile 2016.Effective Android Development. UA Mobile 2016.
Effective Android Development. UA Mobile 2016.UA Mobile
 
Fearless Internationalization and Localization Across the Nations
Fearless Internationalization and Localization Across the NationsFearless Internationalization and Localization Across the Nations
Fearless Internationalization and Localization Across the NationsSiena Aguayo
 
Звиад Кардава "Android Things + Google Weave"
Звиад Кардава "Android Things + Google Weave" Звиад Кардава "Android Things + Google Weave"
Звиад Кардава "Android Things + Google Weave" IT Event
 
Hacking the Explored App by Adding Custom Code (UI5con 2016)
Hacking the Explored App by Adding Custom Code (UI5con 2016)Hacking the Explored App by Adding Custom Code (UI5con 2016)
Hacking the Explored App by Adding Custom Code (UI5con 2016)Nabi Zamani
 
[DEPRECATED]Gradle the android
[DEPRECATED]Gradle the android[DEPRECATED]Gradle the android
[DEPRECATED]Gradle the androidJun Liu
 
A friend in need - A JS indeed
A friend in need - A JS indeedA friend in need - A JS indeed
A friend in need - A JS indeedYonatan Levin
 
(Live) build and run golang web server on android.avi
(Live) build and run golang web server on android.avi(Live) build and run golang web server on android.avi
(Live) build and run golang web server on android.aviSeongJae Park
 
What can possibly go wrong if i dont e2 e test my packages?
What can possibly go wrong if i dont e2 e test my packages?What can possibly go wrong if i dont e2 e test my packages?
What can possibly go wrong if i dont e2 e test my packages?Juan Picado
 
React Nativeの光と闇
React Nativeの光と闇React Nativeの光と闇
React Nativeの光と闇Yukiya Nakagawa
 
[Android] DI in multimodule application
[Android] DI in multimodule application[Android] DI in multimodule application
[Android] DI in multimodule applicationOleg Mazhukin
 

What's hot (20)

What's new in Android at I/O'16
What's new in Android at I/O'16What's new in Android at I/O'16
What's new in Android at I/O'16
 
GWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 PanicGWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 Panic
 
Intro to Gradle + How to get up to speed
Intro to Gradle + How to get up to speedIntro to Gradle + How to get up to speed
Intro to Gradle + How to get up to speed
 
Hack'n Break Android Workshop
Hack'n Break Android WorkshopHack'n Break Android Workshop
Hack'n Break Android Workshop
 
Predictable Web Apps with Angular and Redux
Predictable Web Apps with Angular and ReduxPredictable Web Apps with Angular and Redux
Predictable Web Apps with Angular and Redux
 
Fastlane for Androidによる継続的デリバリー
Fastlane for Androidによる継続的デリバリーFastlane for Androidによる継続的デリバリー
Fastlane for Androidによる継続的デリバリー
 
WordCamp LA 2014- Writing Code that Scales
WordCamp LA 2014-  Writing Code that ScalesWordCamp LA 2014-  Writing Code that Scales
WordCamp LA 2014- Writing Code that Scales
 
Gradle & Android Studio - Introduction
Gradle & Android Studio - IntroductionGradle & Android Studio - Introduction
Gradle & Android Studio - Introduction
 
Intro to Flutter SDK
Intro to Flutter SDKIntro to Flutter SDK
Intro to Flutter SDK
 
Effective Android Development. UA Mobile 2016.
Effective Android Development. UA Mobile 2016.Effective Android Development. UA Mobile 2016.
Effective Android Development. UA Mobile 2016.
 
Angular 2 Básico
Angular 2 BásicoAngular 2 Básico
Angular 2 Básico
 
Fearless Internationalization and Localization Across the Nations
Fearless Internationalization and Localization Across the NationsFearless Internationalization and Localization Across the Nations
Fearless Internationalization and Localization Across the Nations
 
Звиад Кардава "Android Things + Google Weave"
Звиад Кардава "Android Things + Google Weave" Звиад Кардава "Android Things + Google Weave"
Звиад Кардава "Android Things + Google Weave"
 
Hacking the Explored App by Adding Custom Code (UI5con 2016)
Hacking the Explored App by Adding Custom Code (UI5con 2016)Hacking the Explored App by Adding Custom Code (UI5con 2016)
Hacking the Explored App by Adding Custom Code (UI5con 2016)
 
[DEPRECATED]Gradle the android
[DEPRECATED]Gradle the android[DEPRECATED]Gradle the android
[DEPRECATED]Gradle the android
 
A friend in need - A JS indeed
A friend in need - A JS indeedA friend in need - A JS indeed
A friend in need - A JS indeed
 
(Live) build and run golang web server on android.avi
(Live) build and run golang web server on android.avi(Live) build and run golang web server on android.avi
(Live) build and run golang web server on android.avi
 
What can possibly go wrong if i dont e2 e test my packages?
What can possibly go wrong if i dont e2 e test my packages?What can possibly go wrong if i dont e2 e test my packages?
What can possibly go wrong if i dont e2 e test my packages?
 
React Nativeの光と闇
React Nativeの光と闇React Nativeの光と闇
React Nativeの光と闇
 
[Android] DI in multimodule application
[Android] DI in multimodule application[Android] DI in multimodule application
[Android] DI in multimodule application
 

Viewers also liked

Being Epic: Best Practices for Android Development
Being Epic: Best Practices for Android DevelopmentBeing Epic: Best Practices for Android Development
Being Epic: Best Practices for Android DevelopmentReto Meier
 
Android Best Practices - Thoughts from the Trenches
Android Best Practices - Thoughts from the TrenchesAndroid Best Practices - Thoughts from the Trenches
Android Best Practices - Thoughts from the TrenchesAnuradha Weeraman
 
Best Practices for Android UI by RapidValue Solutions
Best Practices for Android UI by RapidValue SolutionsBest Practices for Android UI by RapidValue Solutions
Best Practices for Android UI by RapidValue SolutionsRapidValue
 
Android Performance Best Practices
Android Performance Best Practices Android Performance Best Practices
Android Performance Best Practices Amgad Muhammad
 
iOS Coding Best Practices
iOS Coding Best PracticesiOS Coding Best Practices
iOS Coding Best PracticesJean-Luc David
 
Os Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual MemoryOs Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual Memorysgpraju
 
Android Development: The Basics
Android Development: The BasicsAndroid Development: The Basics
Android Development: The BasicsMike Desjardins
 
Paging and Segmentation in Operating System
Paging and Segmentation in Operating SystemPaging and Segmentation in Operating System
Paging and Segmentation in Operating SystemRaj Mohan
 
LinkedIn’s Culture of Transformation
LinkedIn’s Culture of TransformationLinkedIn’s Culture of Transformation
LinkedIn’s Culture of TransformationPat Wadors
 

Viewers also liked (13)

Being Epic: Best Practices for Android Development
Being Epic: Best Practices for Android DevelopmentBeing Epic: Best Practices for Android Development
Being Epic: Best Practices for Android Development
 
Android best practices
Android best practicesAndroid best practices
Android best practices
 
Android Best Practices - Thoughts from the Trenches
Android Best Practices - Thoughts from the TrenchesAndroid Best Practices - Thoughts from the Trenches
Android Best Practices - Thoughts from the Trenches
 
Android in practice
Android in practiceAndroid in practice
Android in practice
 
Best Practices for Android UI by RapidValue Solutions
Best Practices for Android UI by RapidValue SolutionsBest Practices for Android UI by RapidValue Solutions
Best Practices for Android UI by RapidValue Solutions
 
Android Performance Best Practices
Android Performance Best Practices Android Performance Best Practices
Android Performance Best Practices
 
Paging
PagingPaging
Paging
 
iOS Coding Best Practices
iOS Coding Best PracticesiOS Coding Best Practices
iOS Coding Best Practices
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
Os Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual MemoryOs Swapping, Paging, Segmentation and Virtual Memory
Os Swapping, Paging, Segmentation and Virtual Memory
 
Android Development: The Basics
Android Development: The BasicsAndroid Development: The Basics
Android Development: The Basics
 
Paging and Segmentation in Operating System
Paging and Segmentation in Operating SystemPaging and Segmentation in Operating System
Paging and Segmentation in Operating System
 
LinkedIn’s Culture of Transformation
LinkedIn’s Culture of TransformationLinkedIn’s Culture of Transformation
LinkedIn’s Culture of Transformation
 

Similar to Best Android Development Practices

Accelerate Your IoT and Robotics Development Using Web Technology and Apache ...
Accelerate Your IoT and Robotics Development Using Web Technology and Apache ...Accelerate Your IoT and Robotics Development Using Web Technology and Apache ...
Accelerate Your IoT and Robotics Development Using Web Technology and Apache ...Intel® Software
 
Android Study Jam
Android Study Jam Android Study Jam
Android Study Jam DSCMESCOE
 
Programming for non tech entrepreneurs
Programming for non tech entrepreneursProgramming for non tech entrepreneurs
Programming for non tech entrepreneursRodrigo Gil
 
Headless Android at AnDevCon3
Headless Android at AnDevCon3Headless Android at AnDevCon3
Headless Android at AnDevCon3Opersys inc.
 
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...Heiko Voigt
 
Is Android the New King of Embedded OSes at Embedded World 2014
Is Android the New King of Embedded OSes at Embedded World 2014Is Android the New King of Embedded OSes at Embedded World 2014
Is Android the New King of Embedded OSes at Embedded World 2014Opersys inc.
 
2013-03-07 indie developer toolkit
2013-03-07 indie developer toolkit2013-03-07 indie developer toolkit
2013-03-07 indie developer toolkitCocoaHeads Tricity
 
Android Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part IAndroid Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part IOpersys inc.
 
GeoServer Developers Workshop
GeoServer Developers WorkshopGeoServer Developers Workshop
GeoServer Developers WorkshopJody Garnett
 
Dublin Unity User Group Meetup Sept 2015
Dublin Unity User Group Meetup Sept 2015Dublin Unity User Group Meetup Sept 2015
Dublin Unity User Group Meetup Sept 2015Dominique Boutin
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplateStanislav Petrov
 
iOS Indie Developer Toolkit - CocoaHeads 3city
iOS Indie Developer Toolkit - CocoaHeads 3cityiOS Indie Developer Toolkit - CocoaHeads 3city
iOS Indie Developer Toolkit - CocoaHeads 3cityMichał Zygar
 
[2020 git lab commit] continuous infrastructure
[2020 git lab commit] continuous infrastructure[2020 git lab commit] continuous infrastructure
[2020 git lab commit] continuous infrastructureRodrigo Stefani Domingues
 
Sidiq Permana - Building For The Next Billion Users
Sidiq Permana - Building For The Next Billion UsersSidiq Permana - Building For The Next Billion Users
Sidiq Permana - Building For The Next Billion UsersDicoding
 
Devoxx : being productive with JHipster
Devoxx : being productive with JHipsterDevoxx : being productive with JHipster
Devoxx : being productive with JHipsterJulien Dubois
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Raising ux bar with offline first design
Raising ux bar with offline first designRaising ux bar with offline first design
Raising ux bar with offline first designKyrylo Reznykov
 
Headless browser: puppeteer and git client : GitKraken
Headless browser: puppeteer and git client : GitKrakenHeadless browser: puppeteer and git client : GitKraken
Headless browser: puppeteer and git client : GitKrakenSheikhMoonwaraAnjumM
 

Similar to Best Android Development Practices (20)

Accelerate Your IoT and Robotics Development Using Web Technology and Apache ...
Accelerate Your IoT and Robotics Development Using Web Technology and Apache ...Accelerate Your IoT and Robotics Development Using Web Technology and Apache ...
Accelerate Your IoT and Robotics Development Using Web Technology and Apache ...
 
Android Study Jam
Android Study Jam Android Study Jam
Android Study Jam
 
Programming for non tech entrepreneurs
Programming for non tech entrepreneursProgramming for non tech entrepreneurs
Programming for non tech entrepreneurs
 
Headless Android at AnDevCon3
Headless Android at AnDevCon3Headless Android at AnDevCon3
Headless Android at AnDevCon3
 
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
What is cool with Domino V10, Proton and Node.JS, and why would I use it in ...
 
Is Android the New King of Embedded OSes at Embedded World 2014
Is Android the New King of Embedded OSes at Embedded World 2014Is Android the New King of Embedded OSes at Embedded World 2014
Is Android the New King of Embedded OSes at Embedded World 2014
 
2013-03-07 indie developer toolkit
2013-03-07 indie developer toolkit2013-03-07 indie developer toolkit
2013-03-07 indie developer toolkit
 
Android Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part IAndroid Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part I
 
GeoServer Developers Workshop
GeoServer Developers WorkshopGeoServer Developers Workshop
GeoServer Developers Workshop
 
Dublin Unity User Group Meetup Sept 2015
Dublin Unity User Group Meetup Sept 2015Dublin Unity User Group Meetup Sept 2015
Dublin Unity User Group Meetup Sept 2015
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
 
iOS Indie Developer Toolkit - CocoaHeads 3city
iOS Indie Developer Toolkit - CocoaHeads 3cityiOS Indie Developer Toolkit - CocoaHeads 3city
iOS Indie Developer Toolkit - CocoaHeads 3city
 
[2020 git lab commit] continuous infrastructure
[2020 git lab commit] continuous infrastructure[2020 git lab commit] continuous infrastructure
[2020 git lab commit] continuous infrastructure
 
How to Enterprise Node
How to Enterprise NodeHow to Enterprise Node
How to Enterprise Node
 
Sidiq Permana - Building For The Next Billion Users
Sidiq Permana - Building For The Next Billion UsersSidiq Permana - Building For The Next Billion Users
Sidiq Permana - Building For The Next Billion Users
 
Devoxx : being productive with JHipster
Devoxx : being productive with JHipsterDevoxx : being productive with JHipster
Devoxx : being productive with JHipster
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Raising ux bar with offline first design
Raising ux bar with offline first designRaising ux bar with offline first design
Raising ux bar with offline first design
 
Headless browser: puppeteer and git client : GitKraken
Headless browser: puppeteer and git client : GitKrakenHeadless browser: puppeteer and git client : GitKraken
Headless browser: puppeteer and git client : GitKraken
 
Software maintenance PyConUK 2016
Software maintenance PyConUK 2016Software maintenance PyConUK 2016
Software maintenance PyConUK 2016
 

Recently uploaded

EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 

Recently uploaded (20)

Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 

Best Android Development Practices

  • 1. © Sean Katz Best ANDROID Development Practices 1
  • 2. © Sean Katz Hello! I AM SEAN KATZ I love (Android) development Hope you’ll love it too. - Software Dev Manager @ Autodesk - Previously Co-Founder @ for-each - 10 Years work in software dev - Passionate about Mobile & Web - Father of Mini 2
  • 3. © Sean Katz SUBJECTS TODAY 1. Architecture 2. Gradle 3. Android Studio 4. Git 5. Manifest 6. APIs & Support Lib 7. App Code Skeletons 1. Boilerplate code 2. Performance 3. Debug & Measure 4. CI 5. Security 6. Graphical Design 3
  • 4. © Sean Katz What is Tipz.io ? ○ 2 in 1: ● Bite-Size Tips platform for acquiring skills ● Open Source Initiative for educational purposes ○ Contribute! Web, Android & iOS dev, DevOps, UX/UI work, marketing, branding, SEO… show your skills on tipz! ○ Earn endless love & real-life reputation 4
  • 5. © Sean Katz Give a Star on GitHub! 5 1. 2. 3.
  • 6. © Sean Katz Tips on learning Tipz - browse tipz.io 6
  • 7. © Sean Katz Tips on learning Tipz - browse commits 7
  • 8. © Sean Katz Tips on learning Tipz - blame a file 8
  • 9. © Sean Katz Tips on learning Tipz - browse pull reqs 9
  • 10. © Sean Katz Tips on learning Tipz - continuously learn 10
  • 11. © Sean Katz Contributors gets backstage access 11
  • 12. © Sean Katz “ FULL BLOWN ARCHITECTURE Weeks of programming can save you hours of planning 12
  • 13. © Sean Katz What is an Android app? Choose one or more: ✓ Activity - display ❏ Service - do ❏ Content Provider - data ❏ Broadcast - communicate 13
  • 14. © Sean Katz PLAN ARCHITECTURE ACTIVITY (or FRAGMENT) Viewable Interactions Foreground SERVICE Engine BlackBox Background Network Go Fetch content Broadcast status CONTENT PROVIDER Data URIs Encapsulation Results? Data CRUD Sync 14
  • 15. © Sean Katz “ GRADLE Computers are good at following instructions, but not at reading your mind - Donald Knuth 15
  • 16. © Sean Katz Hello: GRADLE ● Build system ○ Like Grunt ○ Forget ‘Ant’ ● Groovy ● Terminal run 16
  • 17. © Sean Katz GRADLE Tipz 1. Always use a gradle wrapper ☞ 2. Leverage a top-level build.gradle ☞ 3. Set names to your modules ☞ 4. Prefer a remote maven dependency ☞ 5. Always choose dependencies explicitly ☞ 6. Read the changelog of the Android Build Tools ☞ 17
  • 18. © Sean Katz “ ANDROID STUDIO My favorite things in life don't cost any money. It's really clear that the most precious resource we all have is time - Steve Jobs 18
  • 19. © Sean Katz Hello: ANDROID STUDIO 19
  • 20. © Sean Katz ANDROID STUDIO Tipz 1. Install plugins ☞ 2. Color your logcat ☞ 3. Use Android tools 4. Enforce code styles ☞ 5. Inspect code + Lint 6. Know (and use) code templates ☞ 20
  • 21. © Sean Katz “ GIT Coming together is a beginning. Keeping together is progress. Working together is success - Henry Ford 21
  • 22. © Sean Katz Hello: GIT ● Popular SCM ● Branch away ● Collaborate ● Code Review ● Open Source 22
  • 23. © Sean Katz Hello: GIT & SourceTree 23
  • 24. © Sean Katz Hello: GIT flow ● Master ● Develop ● Feature/* ● Release/* ● Hotfix/* 24
  • 25. © Sean Katz GIT Tipz 1. Your git should hold all the files needed to compile the project from scratch ☞ 2. Always start with a gitignore file first ☞ 3. Don't invent 'gitignore', Look for an already published gitignore for various use cases ☞ 25
  • 26. © Sean Katz “The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had MANIFEST - Eric Schmidt 26
  • 27. © Sean Katz Hello: MANIFEST 27
  • 28. © Sean Katz MANIFEST Tipz 1. Meet Android Dashboard ☞ 2. Manifest's Package name vs build. gradle's Application ID ☞ 3. Carefully add new permissions ☞ 4. Think About android:allowBackup ☞ 5. Guard your components with android: exported='false' ☞ 28
  • 29. © Sean Katz “By failing to prepare, you are preparing to fail ANDROID APIs & SUPPORT LIBRARY - Benjamin Franklin 29
  • 30. © Sean Katz ANDROID APIs Code name Version API level Lollipop 5.0 21 KitKat 4.4.x 19 Jelly Bean 4.1.x, 4.2.x, 4.3.x 16 - 18 Ice Cream Sandwich 4.0.3, 4.0.4 15 Ice Cream Sandwich 4.0.1, 4.0.2 14 Honeycomb 3.x 11-13 Froyo, Gingerbread 2.2.x - 2.3.x 8-10 Cupcake, Donut, Eclair 1.x - 2.1.x 1-7 Minimum API < ~8% users Target API Compiled SDK 30
  • 31. © Sean Katz ❤ SUPPORT LIBRARY Corresponding Features from support API level ● getExternalStorageState ● Notification (additions - wear, car, ...) 21 ● ConnectivityManager ● Notification (additions) ● Nested Fragments (v4) (issue) 16 - 18 ● Fragment ● ActionBar, ActionBarDrawerToggle ● Material design, Toolbar ● ViewPager, FragmentPagerAdapter ● LocalBroadcastManager ● Loader ● Share, ShareActionProvider ● SearchView ● GridLayout 14 11-13 8-10 1-7 Minimum API < ~8% users Target API Compiled SDK 31
  • 32. © Sean Katz ❤ SUPPORT LIBRARY - standalones Corresponding Features from support API level ● DrawerLayout ● SlidingPaneLayout ● PrintHelper ● SwipeRefreshLayout ● CardView ● RecyclerView ● Palette ● Multidex Standalone
  • 33. © Sean Katz APIs & SUPPORT LIB Tipz 1. Always compile to the latest SDK ver ☞ 2. Selecting the Android version you support (minSdkVersion) ☞ 3. Prefer Support Library over built in APIs (even if your minimum API allows it) ☞ 33
  • 34. © Sean Katz “Simplicity is the ultimate form of sophistication APP CODE SKELETONS - Leonardo da Vinci 34
  • 35. © Sean Katz APPLICATION CLASS Tipz 1. Use Application class, don't abuse ☞ 2. Don't use class as a single tone ☞ 3. Don't do lengthy operations ☞ 4. Assume the Application class values never gets deleted ☞ 35
  • 36. © Sean Katz LIFECYCLE Tipz 1. Create a Launcher Activity ☞ 2. A runtime check for version upgrade ☞ 3. If you need to know when your Activity is in resume mode ☞ 4. Fragments are automatically recreated upon Activity re-create ☞ 5. Pick your Fragment: Static or Dynamic ☞ 36
  • 37. © Sean Katz SERVICES, PROVIDERS & DB Tipz 1. Provide an easy instantiation to your component ☞ 2. DB operations are heavy ☞ 3. You probably should use IntentService ☞ 37
  • 38. © Sean Katz SHARED PREFS Tipz https://github.com/tipz/tipz-android/pull/1/ 1. Shared Preference commit() is not the only option 2. Smartly organized SharedPreferences 3. Do not store secrets in the Shared Preferences (+ encryption example) 38
  • 39. © Sean Katz GENERAL CODE Tipz 1. Adapter view data is always there ☞ 2. Keep your logs tidy ☞ 3. Goodbye old List/Grid and Adapters, Hello RecyclerView ☞ 4. Request Resources and not Context ☞ 5. When in need of debug sections, use BuildConfig.DEBUG ☞ 39
  • 40. © Sean Katz “Measuring programming progress by lines of code is like measuring aircraft building progress by weight BOILERPLATE CODE - Bill Gates 40
  • 41. © Sean Katz Hello: BOILERPLATE CODE ○ BaseFragment - tag, debug, inflate ○ BaseLoadingFragment - progress views ○ BaseDataFragment - connects to data ○ BaseDataAdapterFragment - w/ adapter ○ BaseDataAdapterPagingFragment ○ Service ○ IntentService - off-the-ui-thread, queue ○ WakefulIntentService - stays awake ○ BaseService - broadcasts, access ease ○ ContentService - provider, REST api’s 41
  • 42. © Sean Katz BOILERPLATE Samplez 1. “Copy and paste is a design error” 2. BaseDataFragment ☞ 3. RecyclerViewAdapter ☞ 4. BaseContentProvider (+DB) ☞ 5. BaseActivity ☞ 42
  • 43. © Sean Katz “It's hardware that makes a machine fast. It's software that makes a fast machine slow PERFORMANCE - Craig Bruce 43
  • 44. © Sean Katz 1. Context and memory leaks ☞ 2. Avoid Internal Getters/Setters ☞ 3. Minimize view hierarchies 4. Don’t overdraw 5. Let the pros handle images ☞ 6. Bulk/Transactional inserts are faster ☞ PERFORMANCE Tipz 44
  • 45. © Sean Katz “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. DEBUG & MEASURE TOOLS - Brian Kernighan 45
  • 46. © Sean Katz StrictMode 46 Or, Report to logcat ☞ Activate in developer tools
  • 47. © Sean Katz GPU Overdraw 47 No color 0X Blue 1X Green 2X Light Red 3X Dark Red 4X +
  • 48. © Sean Katz Profile GPU Rendering 48 Blue Draw (Java) Red Process (Render) Orange Execute (Pipeline) Green 60 FPS target
  • 49. © Sean Katz Don’t keep activities 49
  • 50. © Sean Katz Show Layout Bounds (Developer tools) 50
  • 51. © Sean Katz Show Layout Bounds (Android Device Monitor) 51
  • 52. © Sean Katz Network Statistics 52 Tag network using: android.net.TrafficStats
  • 53. © Sean Katz Method Tracing 53
  • 54. © Sean Katz Java Heap + MAT 54
  • 55. © Sean Katz System Information 1. Activity Manager State 2. Package Information 3. Memory Usage 4. Memory use over time 5. Graphics State 55
  • 56. © Sean Katz “An iPod, a phone, an internet mobile communicator... these are NOT three separate devices! And we are calling it iPhone! Today Apple is going to reinvent the phone Continuous Integration - Steve Jobs 56
  • 57. © Sean Katz Hello: CI ● Automation ○ Trigger ○ Build ○ Test ○ Deploy ● Tools ○ Jenkins ○ ship.io (SaaS) 57
  • 58. © Sean Katz CI Tipz 1. Use a version numbering scheme ☞ 2. Automated versioning ☞ 3. Store your debug key in git ☞ 58
  • 59. © Sean Katz “The only truly secure system is one that is powered off, cast in a block of concrete and sealed in a lead-lined room with armed guards SECURITY – Gene Spafford 59
  • 60. © Sean Katz SECURITY Tipz 1. Use proguard (see next slide) 2. Silent the logs ☞ 3. Do not store secrets in storage ☞ 4. Run Android Lint for security checks 5. android:exported='false' ☞ 6. Safe keep Production signing key ☞ 60
  • 61. © Sean Katz PROGUARD Tipz 1. Proguard your release, not debug ☞ 2. What's in the stock Android proguard ☞ 3. Run Proguard on a frequent basis ☞ 4. Create separate proguard files ☞ 5. Planning on using json parsers? ☞ 6. Proguard for 3rd party libraries ☞ 61
  • 62. © Sean Katz REVERSE ENGINEERING Tipz 1. Reverse own app for security checkup 2. Steps: a. Rename app.APK to app.ZIP b. extract app.ZIP c. classes.dex -> jar (tool) 3. Output: a. Java files: jar -> clear text java (tool) b. Resources: Folder “res” with the resources 62
  • 63. © Sean Katz “There is no reason anyone would want a computer in their home GRAPHICAL DESIGN - Ken Olson, 1977 63
  • 64. © Sean Katz Android Design Cheat-Sheet 64 http://possiblemobile.com/wp-content/uploads/2014/01/Android-Design-Cheat-Sheet-highres.png
  • 65. © Sean Katz PRODUCTIVE TEAMWORK 1. Productive Teamwork Blog Post ☞ a. Understanding the different configurations b. Planning a dynamic layout c. Real estate of the screen d. Stretching techniques (9 patch) e. Full screen images f. Folder and Files naming conventions g. Marketing (Google Play) assets 65
  • 66. © Sean Katz RESOURCES Tipz 1. Naming conventions for your ID's ☞ 2. You can use '@null' in attributes values ☞ 3. Carefully use platform drawables: '@android:drawable/...' ☞ 4. Custom attributes should use res-auto xmlns ☞ 5. Re-use XML layouts with <include.../> ☞ 66
  • 67. © Sean Katz GENERAL GRAPHICAL Tipz 1. Prefer Toolbar over ActionBar ☞ 2. Hello CardView ☞ 3. Use AppCompat themes ☞ 4. Styles, Themes and dimens = CSS ? ☞ 67
  • 68. © Sean Katz THANKS! Any questions? 68 blog.android-develop.com @_SeanKatz sean.katz@gmail.com www.linkedin.com/in/seankatz
  • 69. © Sean Katz Line Icons by Webalys, Virgil Pana and Mirko Monti are published under a Creative Commons Attribution license and Free for both personal and commercial use. You can copy, adapt, remix, distribute or transmit them. If you use these sets on your presentation remember to keep the “Credits” slide or provide a mention and link to these resources: ● Mirko Monti - Simple line icons ● Virgil Pana - E-commerce icons ● Webalys - Streamline iconset 69 ASSETS CREDITS