Development

Objective
•  Introduction to Android •  Introduction to Android architecture •  To learn Android application states

Who is Android
•  Small start up firm acquired by Google at around July 2005 •  Developed by Open Handset Alliance •  Delivers a complete set of software for mobile devices :
–  Operating System –  Middleware ( between applications and drivers ) –  Key applications for device

Android Releases
•  •  •  •  •  •  •  1.1 Cup Cake - 1.5 Donut - 1.6 Eclair - 2.0/2.1 Froyo - 2.2 Gingerbread Honeycomb

Open Handset Alliance
Mobile operators • China Mobile • KDDI Corporation • NTT DoCoMo • Sprint Nextel • T-Mobile • Telecom Italia • Telefónica Software companies • Ascender Corporation • eBay • Esmertec Commercializa tion companies • Aplix • Noser Engineering • The Astonishing Tribe • Wind River Systems Semiconductor companies • Audience • Broadcom Corporation • Intel Corporation • Marvell Technology Group • Nvidia Corporation • Qualcomm • SiRF Technology Holdings • Synaptics • Texas Instruments Handset manufacturers • HTC • LG • Motorola • Samsung Electronics

• Google

• LivingImage • Myriad • NMS Communications • Nuance Communications • PacketVideo • SkyPop • SONiVOX

Open Handset Alliance
Mobile operators • Vodafone • Softbank Software companies Commerciali Semiconduct Handset zation or manufacture companies companies rs • Borqs • Omron Software • Teleca • AKM Semiconductor • ARM • Atheros Communicatio ns • EMP • ASUSTek • Garmin • Huawei Technologies • Sony Ericsson • Ericsson • Toshiba • Dell

Joined December 9, 2008

Joined May 17, 2009 Joined May 27, 2009

• China Unicom

• SVOX

Open Handset Alliance
Mobile operators Software companies Commerciali Semiconduct Handset zation or manufacture companies companies rs

Joined January 15, 2010

• ZTE Corporation

Joined January 22, 2010

• Sasken Communicatio n Technologies Limited • NXP Software

Joined May 18, 2010 Joined July 12, 2010

• MediaTek

What is Android ?
•  Complete stack •  Open software platform for mobile device development •  Os •  Middleware •  Applications

Components

Components

Components

Components
•  Dalvik Virtual Machine
Develop •  Java Code Compile •  Byte Code Run •  DVM

Components
•  Linux •  for core system services
–  –  –  –  –  security, memory management, process management, network stack, and driver model.

•  The kernel also acts as an hardware abstraction layer between the hardware and the rest of the software stack. •  Proven drivers model •  Each application run it’s own Linux process

Android Applications
•  One application can make use of elements of other applications •  Your application doesn't incorporate the code of the other application or link to it. •  Android simply starts up that piece of the other application when the need arises. •  the system must be able to start an application process when any part of it is needed •  don't have a single entry point •  they have essential components that the system can instantiate and run as needed

Application Activity
•  Activities
–  An activity presents a visual user interface for one focused endeavour the user can undertake. –  One Activity per screen –  All form together to provide a cohesive UI –  Each activity is independent from another

Everyday usage of a mobile device
•  •  •  •  •  •  E.g. User enters home screen User enters email application User reads a email User click on a link to go to a browser From the browser to a map application

Everyday usage of a mobile device
System Process

Home

Home

Email

Mail List

Message

Browser

Browser MAX

Map

Map

Everyday usage of a mobile device
System Process

Home

Home

MAX

Everyday usage of a mobile device
System Process

Home

Home

Email

MAX

Everyday usage of a mobile device
System Process

Home

Home

Email

Mail List

MAX

Everyday usage of a mobile device
System Process

Home

Home

Email

Mail List

MAX

Everyday usage of a mobile device
System Process

Home

Home

Email

Mail List

MAX

Everyday usage of a mobile device
System Process

Home

Home

Email

Mail List

Message

MAX

Everyday usage of a mobile device
System Process

Home

Home

Email

Mail List

Message

Browser MAX

Everyday usage of a mobile device
System Process

Home

Home

Email

Mail List

Message

Browser

Browser MAX

Everyday usage of a mobile device
System Process

Home

Home

Email

Mail List

Message

Browser

Browser MAX

Everyday usage of a mobile device
System Process

Home

Home

Email

Mail List

Message

Map Browser

Browser MAX

Everyday usage of a mobile device
System Process

Home

Home

Browser

Browser

Map MAX

Everyday usage of a mobile device
System Process

Home

Home

Browser

Browser

Map MAX

Everyday usage of a mobile device
System Process

Home

Home

Browser

Browser

Map

Map MAX

Everyday usage of a mobile device
System Process

Home

Home

Browser

Browser

Map

Map MAX

Everyday usage of a mobile device
System Process

Home

Home

Browser

Browser

Map

Map MAX

Everyday usage of a mobile device
System Process

Home

Home

Browser

Browser

Map MAX

Everyday usage of a mobile device
System Process

Home

Home

Browser

Browser

Email Map MAX

Everyday usage of a mobile device
System Process

Home

Home

Browser

Browser

Email

Message MAX

Everyday usage of a mobile device
System Process

Home

Home

Browser

Browser

Email

Message MAX

Everyday usage of a mobile device
System Process

Home

Home

Browser

Browser

Email

Message MAX

Everyday usage of a mobile device
System Process

Home

Home

Browser

Email

Mail List

Message MAX

Everyday usage of a mobile device
System Process

Home

Home

Browser

Email

Mail List MAX

Everyday usage of a mobile device
System Process

Home

Home

Browser

Email

Mail List MAX

Everyday usage of a mobile device
System Process

Home

Home

Browser

Email MAX

Activity State
•  Start state
–  Application start
Activity Starts

onCreate()

•  Functions that android will call before application runs •  Why the need to split into 3 different methods ?

onStart()

onResume()

Activity is running

Activity State
•  Transition before an activity gets killed •  Why split onPause and onStop?
Activity is running Another activity comes in front of the activity onPause() The activity no longer visible

onStop()

onDestroy()

Activity shut down

Activity State
•  Transition from pause to resume
onResume()

Activity is running Another activity comes in front of the activity

The activity comes to the foreground

onPause()

Activity State
•  Transition from Stop to Start •  Stop is called when Activity is no longer visible •  Called visible lifetime
onStart()

onRestart()

The Activity is no longer visible

The activity comes to the foreground

onStop()

Activity State
onPause() Other applications need memory Process is killed User navigates back to activity Activity Starts

The activity is no longer visible

onCreate()

onStop()

•  Killing of an activity by OS •  Why not just call onDestory ?

Activity State
•  Full view

Confused ?
Activity Starts onCreate() onStart() Activity is running Interrupt running Activity

onResume()

onPause()

onStop()

Application Components
•  Activity
–  An activity presents a visual user interface for one focused endeavor the user can undertake, –  Widgets work together to form a cohesive user interface –  Each activity is given a default window to draw in

Application Components
•  Services
–  doesn't have a visual user interface, –  runs in the background for an indefinite period of time
•  E.g. Music playing in the background

–  services run in the main thread of the application process.

Application Components
•  Broadcast receiver
–  receive and react to broadcast announcements –  do not display a user interface –  start an activity in response to the information received –  Make use of notifications to alert users

Application Components
•  Content Providers
–  a specific set of the application's data available to other applications
•  stored in the file system, •  SQLite database

–  Encapsulates data and provide it to the applications through the single interface called ContentResolver –  Use database directly if no sharing of data is required

What is an Android Application ?
•  Assortment of tools •  Can be any thing •  Don’t overdo it
Activity Activity

Application

Activity

Service

Service

Broadcast Content receiver Provider

Tools
•  Applications are developed in Java •  Android core is developed in C •  3rd Party libraries is developed using C++

Software tools
•  •  •  •  Eclipse Android plug-in Emulator DDMS

Eclipse Layout

Eclipse Layout

Code

Resources

DDMS Layout

Device processes

Emulator control

Log

DDMS Layout

Device processes

Emulator control

DDMS Layout

Threads Heap File explorer

Allocation Tracker

Emulator

Keypad control Lcd

Resource
•  http://developer.android.com/index.html •  http://www.google.com •  Look up androidology in youtube

Summary
•  •  •  •  Introduction to Android Architecture Introduction to Android components Activity / Services states Eclipse tools for Android

Sign up to vote on this title
UsefulNot useful