Introduction to Android Development

download Introduction to Android Development

If you can't read please download the document

Transcript of Introduction to Android Development

Slide 1

6 september 2011

www.humiq.nl

Inside Android




Sander Alberink
2-9-2011

Agenda

Intro to Android development

Architecture of the Android OS

Architecture of an android application

Android future developments

About me

6 september 2011

www.humiq.nl

SanderAlberink

Senior Technical Consultant

Android

Qt

Open Source

Working for HUMIQ since 2007

High Tech

Embedded

Internet

35 years old

New standards

Linux

Telecom

Kort over mij, niet elk punt noemen, gewoon even wie ik ben

27 juni 2011

www.humiq.nl

Show of hands

Who owns an Android phone?

Who has a shipping application in the Android Market?

Who has developed for that Android phone?

What is Android?

Open source OS

Developed by Google and Open Handset Alliance

Based on Linux kernel and many open source libraries

Development done in Java

Two flavorsAOSP

'With Google'

What Android is not

It's not another Linux distribution

Userland is completely different

It is not another J2ME implementation

Uses its own optimized VM: Dalvik

Does not accept Java Bytecode, but only optimized DEX files

Class libraries are similar to Java SE, but not completely compatible

27 juni 2011

www.humiq.nl

Android anatomy

Linux kernel changes

Wake-locks

Handles Android Power management

Binder IPC

Inter process communication system

Based on Parcels, allows marshalling objects between processes

Ashmem

Simpler shared memory implementation

Can re-claim shared memory from a crashed program

Out-of-memory killer

Logger

Basis of Android Logcat system

Maintains 4 separate log-buffers, exported via adb

Dalvik VM

Java interpreter with JIT capability

Concurrent GC since 2.3

16-bit, register-based

Java VM is 8-bit, stack-based

Loads DEX files

Pre-processed .class files, up to half the original size

Optimized for low-memory, low-cpu environment

Uses a different instruction set than Java VM

Contains multiple .class files

Class-files are stored uncompressed (execution speed)

Core libraries based on Apache Harmony project

Zygote process preloads typical (approx. 1800) classes and dynamic link libraries so that children start quickly.

Copy-on-write

Only when new process writes page, new page is allocated.

All pages not be written are shared among all zygote children.

Exec system call is not used in zygote.

Exec wipes the page mapping table of the process.

It means exec discards zygote cache.

Zygote is running as UID=0 (root). After forking child process, its UID is changed by setuid system call.

Zygote processes

Intent system

Communication between OS and applications via Intents

OS resolves requested action (e.g. 'edit contact') with all registered Intent receivers

Highly versatile and modular

Allows changing out default functionality for alternatives

What is an Android application

Collection of building blocks

Activities

Intent Receivers

Services

Content Providers

Glued together with XML-files

Controlled by manifest file

Run as a separate Linux process, in a sandbox

Tight security model

Activity lifecycle

An activity has a defined life-cycle

Application can be killed by the Android OS if memory is needed

State changes are triggered by Android OS

Development environment

Android SDK contains the followingAndroid platform libraries

API for different android versions

Full emulator for system

ADB debugger bridge

Unit testing environment

Eclipse plugin

Tooling for performance tuning etc

Intro development on Android

What does the Eclipse plugin offer?

Project wizard

Coding support

Logging

Debugging

Code generation

File explorer

Testing

Unit testing

6 september 2011

www.humiq.nl

Met al deze tools kun je nu een project maken zie volgende sheets (eerst logging en debugging)

6 september 2011

www.humiq.nl

Inleiding ontwikkeling op Android

Als je emulator draait kun je ook de log gegevens realtime bekijken

Intro development on Android

6 september 2011

www.humiq.nl

Nu kun je de applicatie al draaien zie volgende sheet

Different views

Intro development on Android

Project structure

Own code

Generated code

Resources

Strings

Images

Layouts

Values

Animations

Measurements

6 september 2011

www.humiq.nl

Volgende sheet: Gui builder voor layouts

27 juni 2011

www.humiq.nl

Android Future developments

Android Open Accessory Protocol

Project Tungsten/Android @ Home

Google TV

Android Native development

Mention project necessitas

27 juni 2011

www.humiq.nl

Android Open Accessory Protocol

New way to develop accessories for a telephone

Gives the possibility for new accessories and applications for our mobile phones

For Android 3.1: Phones is USB Host (hookup any gamepad and game on!)

For Gingerbread 2.3.4:Phone is a USB slave, accessory delivers power.

Protocol is bi-directional

27 juni 2011

www.humiq.nl

Project Tungsten

Android @Home

Nieuwe klasse Android devices

Geen UI, wel netwerk en audio uitgangen

En mogelijkheden tot home-control

Nieuw protocol (yet another...)

Idee is goed: zaken niet via een adapter controleren, maar direct.

Low-cost, low maintenance.

27 juni 2011

www.humiq.nl

Android Native Development Kit

Development in C/C++

Originally only subroutines in C/C++

Only suitable for computationally expensive routines (physics, graphical rendering)

Now: fully native applications possible

But beware:No POSIX-compliant C-library

No kernel headers

Straightforward porting of software not always possible

Bionic libcLibc/OpenGL ES/

27 juni 2011

www.humiq.nl

Android Native Development Kit 2

Bionic libcLibc/OpenGL ES/

27 juni 2011

www.humiq.nl

Google TV

Android, on your TV

Version 2.0 to be introduced, based on Honeycomb

Finally App-store enabled.

Coming to Europe in 2012

Bionic libcLibc/OpenGL ES/

27 juni 2011

www.humiq.nl

Thank you for your attention! Questions?

6 september 2011

www.humiq.nl

6 september 2011

www.humiq.nl

6. September 2011

www.humiq.nl

Mastertitelformat bearbeiten

Zweite Zeile

Mastertextformat bearbeiten

Zweite Ebene

Dritte Ebene

Vierte Ebene

Fnfte Ebene

Mastertitelformat bearbeiten

Zweite Zeile

Mastertextformat bearbeiten

Zweite Ebene

Dritte Ebene

Vierte Ebene

Fnfte Ebene

6 september 2011

www.humiq.nl

6 september 2011

www.humiq.nl

27 juni 2011

www.humiq.nl