Introduction to Android App Development

42
Android Development http://dycode.co.id | offi[email protected] | @dycode Beginner Level Training DyPlex, March 31, 2015

Transcript of Introduction to Android App Development

Page 1: Introduction to Android App Development

Android Development

http://dycode.co.id | [email protected] | @dycode

Beginner Level Training

DyPlex, March 31, 2015

Page 2: Introduction to Android App Development

Andri Yadi

CEO, DyCode

Lead Trainer

Page 3: Introduction to Android App Development

Bayu WYMobile Team Lead, DyCode

Page 4: Introduction to Android App Development

About DyCode 8 years company

End-to-end mobile app solutions developer company

Award-winning companies

100+ mid-to-large projects, 3 products, including a well-know app: Movreak, Jepret Story

Page 5: Introduction to Android App Development

Intro to Android

Page 6: Introduction to Android App Development

Android BackgroundA Software Stack: OS, Middle-ware, key apps.Developed by Android Inc. Bought by Google in 2005.

Based on Linux kernel

Open Source Android Open Source Project (AOSP), led by Google. Under Apache 2.0 License. Developed by Open Handset Alliance. Huge code base

Application layer is Java-based

Android is NOT Linux. No native windowing system. No glibc support.NO GNU/LINUX utilities

Page 7: Introduction to Android App Development

Android Background

Open Handset Alliance?

A consortium of several companies

Devoted to advancing open standards for mobile devices

Develop technologies that will significantly lower the cost of developing and distributing mobile devices and services.

Page 8: Introduction to Android App Development

Architecture

Page 9: Introduction to Android App Development

Linux Kernel

Linux Kernel: basic hardware abstraction, memory management, process management, networking, and other operating system services.

Display Driver Camera Driver Flash Memory Driver Binder (IPC) Driver

Keypad Driver WiFi Driver Audio Driver Power Management

Page 10: Introduction to Android App Development

Libraries

Native Libraries:  written in C or C++, Standard C lib. Only to be called by higher level programs

Surface Manager Media Framework SQLite OpenGL ES

FreeType WebKit SGL SSL libc

Page 11: Introduction to Android App Development

Android Runtime

Core Libraries consists of most of standard Java libraries (but not J2SE/J2ME). Don’t use VM, Dalvik VM instead. Run .dex files. Each app runs in its own VM

Core Libraries Dalvik Virtual Machine

Page 12: Introduction to Android App Development

Application Framework

Full set of services built in Java View & windows, resources, content providers, phone services & APIs, notifications, application life-cycle management All apps directly interact with this layer

Activity Manager Window Manager Content Providers

View System

Package Manager Telephony Manager Resource Manager

Location Manager Notification Manager

Page 13: Introduction to Android App Development

Applications

Applications and Widgets: the real programs display information and interact with users.

Home Contacts Browser Your app

Page 14: Introduction to Android App Development

Android Applications

Loosely coupled set of services

One or more: Activities (≃ screens)Services (≃ background processes)Broadcast receiver (≃ waiting and response) Content providers (≃ provides some data, mostly backed by SQLite)

Can use other apps functionality (≃ intent)

Page 15: Introduction to Android App Development

Android ApplicationsSet of activities

Page 16: Introduction to Android App Development

Application Lifecycle

Controlled by TasksA task is a set of activities arranged in a stack

Root TaskLaunching an app makes it the root of a task New activities pushed on the task task (default behaviour)

Activity 2

Activity 1

Task

Page 17: Introduction to Android App Development

Application Lifecycle

App ProcessAll apps are run in their own process

PriorityAndroid manages memory by prioritising processes and killing least important ones

Page 18: Introduction to Android App Development

Application Lifecycle

Jepret Story app process Twitter app process

Page 19: Introduction to Android App Development

Flavours (or version)

Page 20: Introduction to Android App Development

OS Version & API LevelAndroid 1.0

Android 1.1

Android 1.5 Cupcake

Android 1.6 Donut (API level 4)

Android 2.0 Eclair (API level 5)

Android 2.0.1 Eclair (API level 6)

Android 2.1 Eclair (API level 7)

Android 2.2–2.2.3 Froyo (API level 8)

Android 2.3–2.3.2 Gingerbread (API level 9)

Android 2.3.3–2.3.7 Gingerbread (API level 10)

Android 3.0 Honeycomb (API level 11)

Android 3.1 Honeycomb (API level 12)

Android 3.2 Honeycomb (API level 13)

Android 4.0–4.0.2 Ice Cream Sandwich (API level 14)

Android 4.0.3–4.0.4 Ice Cream Sandwich (API level 15)

Android 4.1 Jelly Bean (API level 16)

Android 4.2 Jelly Bean (API level 17)

Android 4.3 Jelly Bean (API level 18)

Andriod 4.4–4.4.4 Kitkat (API level 19)

Andriod 4.4W Kitkat with Wearable Extensions (API level 20)

Android 5.0-5.02 Lollipop (API Level 21)

Android 5.1 Lollipop (API Level 22)

Page 21: Introduction to Android App Development

Security & PermissionsEach Android package is given its own unique Linux user ID

An app is sandboxed and can't disrupt other apps, except by explicitly declaring the permissions for it

Permissions: Declarative permission in manifest file Users are prompted at install time

Apps (APK files) are signed locally

Page 22: Introduction to Android App Development

Android 5.0Some updates on…

Page 23: Introduction to Android App Development

Material Design

Visual Language + Good Design + Innovation

Page 24: Introduction to Android App Development

Material Design

ColorsLarge areas, suggested color palette

ImagesMore personal & emotional content

“3D” Mostly 2D & 2.5D to give structure

Light and Shadow Cards and overlays

Page 25: Introduction to Android App Development

Material Design

Flat No bevels, gradients, effects

AnimationsExplains interaction

TypographyRoboto and font style definitions

Layout templates Margins, key lines, etc.

Page 26: Introduction to Android App Development

Material Design

Elements of Material Design in Android

New themeNew Widgets for complex views  New API for Custom Shadows & Animation

Page 27: Introduction to Android App Development

ToolBar is a generalized ActionBar More flexible

setActionBar(toolBar) Option menu actions

Can be placed anywhere in the layout For example, in a pop up Fragment

Toolbar is just another View

Page 28: Introduction to Android App Development

Android RunTime (ART)

Good bye DalvikART runtime replaces Dalvik as the platform default

FeaturesAhead of time compilation (AOT) Better Garbage Collection (GC) 64 bit support Better Profiling and Debugging

First appearance in Android 4.4 (experimental)

Page 29: Introduction to Android App Development

ART - AOTCompilation during installationInstallation takes longer More storage required (DEX + Compiled)

Better startup time

No compilation lags during execution

Compiled ART code is fasterthan compiled Dalvik code

In general, better battery life, less memory consumption

Page 30: Introduction to Android App Development

WebView

Chromium 37

Includes: WebGL WebAudioWebRTC

Updateable from Google Play

Permissions for camera, microphone, ...

Page 31: Introduction to Android App Development

Notification

Heads up notifications (floating)

Privacy notification setting for lockscreen

Page 32: Introduction to Android App Development

Camera

Uncompressed 8MP YUV at 30 FPS

Capture raw sensor data & control parametersExposureISO sensitivity

Page 33: Introduction to Android App Development

Connectivity

Bluetooth LE Peripheral ModeBroadcast presence to nearby devices

Scan and connect to specific network

Page 34: Introduction to Android App Development

Dev Tool

Page 35: Introduction to Android App Development
Page 36: Introduction to Android App Development

Integration with Android Studio

A Single Build System

Android Signing Configuration

Multi-project Support

Full Incremental Builds

apply plugin: 'com.android.application'

android { compileSdkVersion 21 buildToolsVersion "21.1.2"

defaultConfig { applicationId “example.app.android" minSdkVersion 10 targetSdkVersion 21 versionCode 1 versionName "1.0" }}

Page 37: Introduction to Android App Development

Genymotion

Faster Android Emulator

Free for personal use onlyOnly provides emulation on GPS, Camera

EUR24.99 per month, per user

Page 38: Introduction to Android App Development

Intel HAXMIntel® Hardware Accelerated Execution Manager a hardware-assisted virtualization engine that uses Intel Virtualization Technology to speed up Android app emulation on a host machine

Suppots Windows, Linux, OS X

Requirement Intel HAXM installer Intel x86 Atom System Image

Page 39: Introduction to Android App Development

Google Play

Page 40: Introduction to Android App Development

Google Play

Distribute and find Android apps

Get started Sign up for Developer Account Accept Developer Distribution Agreement Pay $25 one-time registration fee Complete details

https://play.google.com/apps/publish

Page 41: Introduction to Android App Development

Google Play

Google Play began to review app*

Payment:Credit CardGoogle Play Gift CardOperator Billing

30% cut for Google Play

Page 42: Introduction to Android App Development

DyCode Eduhttp://edu.dycode.co.id [email protected] @dycode

More pro training?