December 15

Preview:

DESCRIPTION

My slides as a guest lecturer in University Indraprasta PGRI Indonesia December 15, 2011.

Citation preview

Android ArchitectureRhama Arya W.

@arya199

www.mreunion-labs.net

Thursday, December 15, 11

Mreunion Labs

March 2010

Bootstrapped startup

Android first

Thursday, December 15, 11

Agenda

• Introduction to Android

• Android Architecture

• Fundamental building blocks

• Ideas, execution, feedback, repeat

• Best practices

Thursday, December 15, 11

Trends

• Mobile 2.0

• Android, iOS, WP7

• BlackBerry? Symbian?

• One year exp, published a real working Android app on the market, confident interview

Thursday, December 15, 11

What is Android?

• Not really a Linux

• Based on a linux kernel but it’s not GNU

• No native windowing system

• No (limited?) glibc support

• No GNU/Linux utilities

Thursday, December 15, 11

What is Android?

• Not just ‘Java on Linux.’

• Not part of the JCP

• Developers write primarily in a customized version of Java

• Similar to Java SE, but not equal

• No AWT, no Swing, no RMI

Thursday, December 15, 11

What is Android?

• software stack that includes:

• operating system

• middleware

• key applications

• rich set of APIs

Thursday, December 15, 11

Android Architecture

Thursday, December 15, 11

Android Architecture• Linux kernel 2.6, providing

• Security

• Memory Management

• Process Management

• Network Stack

• Driver Model

• Abstraction Layer

Thursday, December 15, 11

Android Architecture

• Dalvik Virtual Machine

• Runs optimized file format (.dex)

• Java .class/.jar files converted into .dex at build time

• Supports multiple virtual machine processes per VM

Thursday, December 15, 11

Android Architecture

• Dalvik Virtual Machine

• 16bit, register based

• JIT from “Froyo”

• Concurrent GC from “Gingerbeard”

Thursday, December 15, 11

Android Architecture

• C/C++ Libraries used by various components of the Android system

• Exposed to developers through the Android Application Framework

• SQLite, WebKit, Open GL, libc

Thursday, December 15, 11

Android Architecture

• Android Application Framework exposing developers to Android’s inner capabilities

• View System, Content Providers, Telephony Manager, Location Manager, Notification Manager, Activity Manager, etc

• Javadoc styled API

• developer.android.com

Thursday, December 15, 11

Assets

Application Fundamentals

You

XML .apk

Android Manifest

Java classes

multi-user Linux-like systemeach application is a different user

each application has its own processeach process has its own VM runs in

isolation from other applications

possible to have two applications to share the same Linux user ID

request permission to access device dataContentProviders

Thursday, December 15, 11

Building Blocks

AndroidManifest.xml

Act

iviti

es

Vie

ws

Inte

nts

Serv

ices

Not

ifica

tions

Con

tent

Prov

ider

s

Thursday, December 15, 11

Building Blocks

Thursday, December 15, 11

Building Blocks

Activity A

Activity B

• stacked

• only one is visible

• only one is active

• new activities are placed on top

Thursday, December 15, 11

Building Blocks

ViewGroup

ViewGroup View View

View View View

• Android’s UI

• know how to draw themselves

• respond to events

• described in XML

Thursday, December 15, 11

Building Blocks

private View view;

public void onCreate(Bundle savedInstanceState) {...setContentView(R.layout.filename);...name = (View) findViewById(R.id.name);...

}

Thursday, December 15, 11

Building Blocks

Activity A Activity BIntent

SQLite Database

Intents are used to move from Activity to Activity

Describes what the Application wants

Provide late runtime bindings

Thursday, December 15, 11

Building Blocks

• Services

• Notifications

• ContentProviders

• SQLite Database

Thursday, December 15, 11

“Idea is worthless. Execution is what matters.”

Thursday, December 15, 11

Ideas

• Steal, simplify, beautify, improve

• Solve a real problem

• Exercise

• You don’t have to be the first. But be the best

Thursday, December 15, 11

Execution

Start coding

Use it

Get feedback

One download = one customer = one problem.Prioritize

Learn to say “No”

Thursday, December 15, 11

Best Practice

• Mobile users are impatient

• Fast, beautiful, intuitive apps

• Minimize actions required per function

• Competitions are fierce

• It’s not easy

Thursday, December 15, 11

Resources

• http://developer.android.com

• http://stackoverflow.com

• http://android-developers.blogspot.com

• http://helloandroid.com

• http://mreunion.wordpress.com

• id-android-dev@googlegroups.com

Thursday, December 15, 11

Thank Yourhama.arya@gmail.com

@arya199

Thursday, December 15, 11