Slide 1

Slide 1 text

GETTING STARTED WITH ANDROID DEV 2016 Scott Alexander-Bown @scottyab

Slide 2

Slide 2 text

WHO THE HECK IS THIS GUY? ➤ Freelance (remote) Android Developer ➤ https://scottyab.com ➤ Google Developer Expert for Android ➤ Founder/Organiser SWMobile Meetup ➤ http://swmobile.org ➤ Co-Author Android Security Cookbook ➤ Follow on Twitter @scottyab @scottyab

Slide 3

Slide 3 text

@scottyab

Slide 4

Slide 4 text

AT A GLANCE ➤Tools / IDE ➤Components ➤Dependancies / 3rd Party Libs ➤Tips *Reminder LAB - 11am to Midday, Wednesday 9th November 2016 Merchant Venturer's Building 2.11 Linux Computer Lab

Slide 5

Slide 5 text

What is Android?

Slide 6

Slide 6 text

https://developer.android.com @scottyab

Slide 7

Slide 7 text

@scottyab

Slide 8

Slide 8 text

Android Components @scottyab

Slide 9

Slide 9 text

ACTIVITY ➤ AKA a Screen ➤ has distinct lifecycle ➤ onCreate() ➤ onStart() ➤ onResume() ➤ onPause() ➤ onStop() ➤ onDestory() https://play.google.com/store/apps/details?id=name.peterscully.learning.activitylifecycle @scottyab

Slide 10

Slide 10 text

RESOURCES AND LAYOUTS ➤ Layouts • Xml ➤ Values • Strings • Styles ➤ Drawables

Slide 11

Slide 11 text

DESIGN XML

Slide 12

Slide 12 text

INTENTS ➤ Action ➤ Extra ➤ Primitives ➤ Parcelables public void sendMessage(String message) {
 Intent intent = new Intent(this, DisplayMessageActivity.class);
 intent.putExtra(EXTRA_MESSAGE, message);
 startActivity(intent);
 } @scottyab

Slide 13

Slide 13 text

@Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_display_message);
 
 Intent intent = getIntent();
 String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
 
 TextView messageText = (TextView)findViewById(R.id.messageText);
 messageText.setText(message);
 }

Slide 14

Slide 14 text

SERVICES ➤ Background operations ➤ Lifecycle ➤ Service ➤ Bind ➤ IntentService ➤ Work thread ➤ Start with Intent @scottyab

Slide 15

Slide 15 text

ANDROID MANIFEST.XML @scottyab

Slide 16

Slide 16 text

LISTS / RECYCLERVIEW ➤ Xml Layout for list ➤ Layout for the row ➤ Adapter ➤ Binding ➤ ViewHolder ➤ RecyclerView.setAdapter(…) @scottyab

Slide 17

Slide 17 text

FRAGMENTS ➤ Reusable UI/Logic component ➤ Own Lifecycle @scottyab

Slide 18

Slide 18 text

.APK AND DISTRIBUTION ➤ Android apps are packaged as .apk files ➤ Signed with developer signing key ➤ Upload to the Play Store • $25 one off registration fee • Screen shots • Unique App Id @scottyab

Slide 19

Slide 19 text

Dependancies and 3rd party libraries

Slide 20

Slide 20 text

GRADLE ➤ Run from CI and IDE ➤ Easy dependancy management ➤ Build variants • types • flavours

Slide 21

Slide 21 text

INCLUDING DEPENDANCIES ➤ build.gradle dependencies {
 /*
 * Google Play services
 */
 compile 'com.google.maps.android:android-maps-utils:0.4.4'
 compile 'com.google.android.gms:play-services-maps:9.6.1'
 compile 'com.google.android.gms:play-services-location:9.6.1' @scottyab

Slide 22

Slide 22 text

INCLUDING DEPENDANCIES (JITPACK) compile 'com.github.scottyab:Calligraphy:v2.1.1_LABEL_FOR' @scottyab

Slide 23

Slide 23 text

SUPPORT LIBRARY ➤ Backward-compatible versions of framework components. ➤ UI elements to implement the recommended Android layout patterns. ➤ Support for different form factors. ➤ Miscellaneous utility functions. @scottyab

Slide 24

Slide 24 text

https://github.com/JakeWharton/butterknife UI: BUTTER KNIFE @scottyab

Slide 25

Slide 25 text

CONVERT JAVA OBJECTS INTO JSON AND BACK https://github.com/google/gson API: GSON @scottyab

Slide 26

Slide 26 text

TYPE-SAFE HTTP CLIENT MAKES APIS EASY SIMPLE ASYNC https://github.com/square/retrofit API: RETROFIT @scottyab

Slide 27

Slide 27 text

@scottyab

Slide 28

Slide 28 text

T ANDROID-ARSENAL.COM

Slide 29

Slide 29 text

@scottyab

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

USE GIT ➤ GitHub ➤ GitLab.com ➤ BitBucket @scottyab

Slide 32

Slide 32 text

TIPS ▸ Lock to portrait ▸ Focus on limited devices ▸ Test on demo devices ▸ Target SDK 15+ (or even 21+) @scottyab

Slide 33

Slide 33 text

AVOID ▸ Child Fragments ▸ Constraint layout ▸ Bleeding edge! @scottyab

Slide 34

Slide 34 text

FABRIC / CRASHLYTICS ➤ By Twitter ➤ Crash Reporting ➤ Beta distribution ➤ Analytics ➤ https://get.fabric.io @scottyab

Slide 35

Slide 35 text

SAMPLE APPS ▸ github.com/google/iosched ▸ github.com/googlesamples/android-topeka ▸ github.com/nickbutcher/plaid ▸ github.com/chrisbanes/philm ▸ github.com/JakeWharton/u2020 ▸ github.com/googlesamples @scottyab

Slide 36

Slide 36 text

@scottyab

Slide 37

Slide 37 text

THANKS swmobile.org github/scottyab @scottyab [email protected] QUESTIONS? LAB - 11am to Midday, Wednesday 9th November 2016 Merchant Venturer's Building 2.11 Linux Computer Lab

Slide 38

Slide 38 text

QUESTIONS? @scottyab