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

Post on 16-Jan-2016

221 views 0 download

Tags:

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

Introduction of AndroidIntroduction of Android

Blackmore Hsiao & Steve HuWGT12008/12/26

Blackmore Hsiao & Steve HuWGT12008/12/26

Qisda Confidential 2007

OutlineWhat is Android

Android Architecture

Development Environment of Android

What is AndroidWhat is Android

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, …

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

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

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

Android ArchitectureAndroid Architecture

Qisda Confidential 2007

Android Architecture

MiddlewareMiddleware

Qisda Confidential 2007

Android Architecture

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

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

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

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

Qisda Confidential 2007

Package ManagerManage the application packages that

are currently installed on the device

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

Qisda Confidential 2007

Resource ManagerProviding access to non-code

resources such as localized strings, graphics, and layout files

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

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

Qisda Confidential 2007

Android Architecture

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

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

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

Qisda Confidential 2007

Android Architecture

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!

Development Environment of AndroidDevelopment Environment of Android

Qisda Confidential 2007

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

Qisda Confidential 2007

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

GO

Qisda Confidential 2007

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

Qisda Confidential 2007

下載路徑

GO

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

Qisda Confidential 2007

安裝 Java Development Kit(JDK)

GO

Qisda Confidential 2007

安裝 JDK(1)

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

安裝 JDK(2)

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

安裝 JDK(3)

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

安裝 JDK(4)

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

安裝 JDK(5)

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

安裝 Android Eclipse Plugin

GO

Qisda Confidential 2007

在 Help 選單選擇 Software Updates

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

在 Available Software 選擇 Add Site

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

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

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

勾選輸入的 URL

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

選擇 Install

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

選擇 Next

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

Accept the license agreement

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

Progressing

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

Restart

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

指定 Android SDK位置

GO

Qisda Confidential 2007

選擇 Window 下的 Preferences

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

Browse to SDK Location

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

選擇確定

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

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

GO

Qisda Confidential 2007

選擇 File 下 New->Project

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

選擇 Android Project

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

輸入參數

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

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

Blackmore.Hsiao
What is protection Domain?What is soft restriction?

Qisda Confidential 2007

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