59
Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Embed Size (px)

Citation preview

Page 1: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Introduction of AndroidIntroduction of Android

Blackmore Hsiao & Steve HuWGT12008/12/26

Blackmore Hsiao & Steve HuWGT12008/12/26

Page 2: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

OutlineWhat is Android

Android Architecture

Development Environment of Android

Page 3: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

What is AndroidWhat is Android

Page 4: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

What is AndroidAndroid is a ROBOT that looks completely

human

An Open Handset Alliance ProjectOHA members: 47 members currently

Mobile Operators: NTT, T-Mobile, Vodafone,… Handset Manufacturers: HTC, Moto, SE, LG, … Semiconductor Companies: Intel, Qualcomm, … Software Companies: Google, eBay, …

Page 5: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

What is AndroidSoftware stack for mobile devices that

includes an operating system, middleware and key applications

Using Java programming language to develop applications

Page 6: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Features1. Application framework

Enabling reuse and replacement of components2. Dalvik virtual machine

Optimized for mobile devices3. Integrated browser

Base on the open source WebKit engine4. Optimized graphics

Powered by a custom 2D graphics library; 3D graphics based on the OpenGL ES 1.0 specification (hardware acceleration optional)

5. SQLite For structured data storage

Page 7: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Features6. Media support

For common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF)

7. GSM Telephony Hardware dependent

8. Bluetooth, EDGE, 3G, and WiFi Hardware dependent

9. Camera, GPS, compass, and accelerometer

Hardware dependent10. Rich development environment

Including a device emulator, tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE

Page 8: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Android ArchitectureAndroid Architecture

Page 9: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Android Architecture

MiddlewareMiddleware

Page 10: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Android Architecture

Page 11: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Activity Manager An Activity is a chunk of code that does

some work; it usually includes display UI to user, but not necessary

Typically, you'll designate one of your application's Activities as the entry point to your application

Manage the life cycle of applications and provides a common navigation backstack

Page 12: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Window ManagerManage all the opened Window

public void removeViewImmediate(View view) This is not for normal applications; using it

correctly requires great care

Page 13: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Content ProvidersA content provider is a data

storehouseOnly required if you need to share data

between multiple applications

For example, the contacts data is used by multiple applications and must be stored in a content provider

Page 14: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

View System View represents the basic UI building block A rich and extensible set of views: Lists,

Grids, text boxes, buttons, and even an embeddeable web browser View-Gallery

All of the views in a window are arranged in a single tree

Implementing a Custom View: override methods when FocusChanged, key event, touch screen motion event, …etc happened

Page 15: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Package ManagerManage the application packages that

are currently installed on the device

Page 16: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Telephony ManagerProvide access to information about

the telephony services on the device

Application can register a listener to receive notification of telephony state changes

Page 17: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Resource ManagerProviding access to non-code

resources such as localized strings, graphics, and layout files

Page 18: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Location ManagerLocation information from GPS or

Network

public Location getLastKnownLocation(String provider)

Then use the location to get latitude, longitude, altitude, speed, …etc

Page 19: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Notification ManagerEnables all applications to display

custom alerts in the status bar To tell the user that something has

happened in the background

Notification typePersistent icon that goes in the status bar Turning on or flashing LEDs Alerting the user by flashing the backlight,

playing a sound, or vibrating

Page 20: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Android Architecture

Page 21: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Libraries Surface manager: Manage display and

seamlessly composites 2D and 3D graphic OpenGL ES: 3D graphics SGL: 2D graphics Media Framework: support different media

type FreeType: bitmap and vector font rendering SSL: Secure Socket Layer SQLite: lightweight database engine WebKit: browser engine Libc: standard C system library

Page 22: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Dalvik Virtual MachineDevelop by Dan BornsteinNamed it after the fishing village of

Dalvík in Eyjafjörður, Iceland

NOT a Standard Java Virtual Machine (JVM)Compile Java source code to compact .dex

file, and then run on Dalvik VMJava class file need to use “dx” tool

compile to .dex file

Page 23: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Dalvik Virtual MachineRegister-Based Architecture (cf.

Stack-Based in JVM) which is designed for resource limited mobile device

On Android, every Application runs in its own process, with its own instance of Dalvik VM

Page 24: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Android Architecture

Page 25: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Linux KernalLinux 2.6 for core system services such

as security, memory management, process management, network stack, and driver model

Act as abstraction layer between hardware and the rest of software stack

Why linux? Because It’s already open source!

Page 26: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Development Environment of AndroidDevelopment Environment of Android

Page 27: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Agenda 為何使用 Eclipse 做為 Android 編輯環境 下載路徑 安裝 Java Runtime Environment 安裝 Android Eclipse Plugin 指定 Android SDK 位置 建立新專案與使用模擬器執行程式 Summary

Page 28: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

為何使用 Eclipse做為 Android編輯環境

GO

Page 29: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

用 Eclipse 開發 Android 的好處 1 :免費 2 :免費 3 :免費

Page 30: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

下載路徑

GO

Page 31: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

下載路徑 1 :下載 Google Android SDK

http://code.google.com/android/download.html 2 :下載 eclipse

http://www.eclipse.org/downloads/ 3 :下載 JDK

http://java.sun.com/javase/downloads/index.jsp

Page 32: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

安裝 Java Development Kit(JDK)

GO

Page 33: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

安裝 JDK(1)

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 34: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

安裝 JDK(2)

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 35: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

安裝 JDK(3)

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 36: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

安裝 JDK(4)

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 37: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

安裝 JDK(5)

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 38: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

安裝 Android Eclipse Plugin

GO

Page 39: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

在 Help 選單選擇 Software Updates

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 40: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

在 Available Software 選擇 Add Site

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 41: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

輸入 URL : http://dl-ssl.google.com/android/eclipse/

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 42: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

勾選輸入的 URL

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 43: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

選擇 Install

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 44: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

選擇 Next

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 45: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Accept the license agreement

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 46: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Progressing

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 47: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Restart

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 48: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

指定 Android SDK位置

GO

Page 49: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

選擇 Window 下的 Preferences

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 50: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Browse to SDK Location

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 51: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

選擇確定

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 52: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

建立新專案與使用模擬器執行程式

GO

Page 53: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

選擇 File 下 New->Project

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 54: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

選擇 Android Project

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 55: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

輸入參數

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 56: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

在專案名稱上按下滑鼠右鍵 ->Run As->Android Application

Blackmore.Hsiao
What is protection Domain?What is soft restriction?
Page 57: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26

Qisda Confidential 2007

Summary Eclipse 是免費的 IDE 。 安裝 JDK 安裝 Android Plugin 指向 Android SDK 建立新專案,使用模擬器執行程式。

Page 59: Introduction of Android Blackmore Hsiao & Steve Hu WGT1 2008/12/26 Blackmore Hsiao & Steve Hu WGT1 2008/12/26