Eclipse n plugin n OS Linux kernel version

  • Slides: 49
Download presentation

安裝與實作預備知識 開發目前以Eclipse為配套開發 具 n 下載plug-in同時亦配備相關的模擬器及開 發 具 n ¨ OS: Linux kernel - version

安裝與實作預備知識 開發目前以Eclipse為配套開發 具 n 下載plug-in同時亦配備相關的模擬器及開 發 具 n ¨ OS: Linux kernel - version 2. 6 ¨ Emulator: on Mac, Windows, Linux ¨ Hardware support: GSM Telephony n Bluetooth, 3 G, and Wi. Fi n Camera, GPS and accelerometer n

Android開發環境 n 所需開發環境 ¨ Sun – Java Development Toolkit (不介紹) ¨ Eclipse – 以及ADT

Android開發環境 n 所需開發環境 ¨ Sun – Java Development Toolkit (不介紹) ¨ Eclipse – 以及ADT plug-in ¨ Android SDK 15

IDE-Eclipse n n Java Integrated Development Environment Download Site: ¨ http: //www. eclipse. org/downloads/

IDE-Eclipse n n Java Integrated Development Environment Download Site: ¨ http: //www. eclipse. org/downloads/

Eclipse plug-in for Android-ADT n Update Plug-in from Eclipse Site: ¨ [Software]->[add site]->[location] 加入https:

Eclipse plug-in for Android-ADT n Update Plug-in from Eclipse Site: ¨ [Software]->[add site]->[location] 加入https: //dl-ssl. google. com/android/eclipse/

Operation n Play Emulator ¨ Programming n and Setting Remove Application

Operation n Play Emulator ¨ Programming n and Setting Remove Application

Play Emulator n "File -> New -> Project "

Play Emulator n "File -> New -> Project "

Play Emulator This is the name of the directory that you want to contain

Play Emulator This is the name of the directory that you want to contain the project must be unique on an API a class can run and work the title for the application

http: //code. google. com/android/intro/tutorial. html

http: //code. google. com/android/intro/tutorial. html

Play Emulator n "Run -> Open Run Dialog"

Play Emulator n "Run -> Open Run Dialog"

Remove Application n 命令提示字元¨ 啟動 adb shell n ¨ # adb shell 切換目錄 n

Remove Application n 命令提示字元¨ 啟動 adb shell n ¨ # adb shell 切換目錄 n n # cd data/app/ # ls (查看檔案) ¨ ¨ ¨ 移除檔案 n n Notes. List. apk Api. Demos. apk # rm Notes. List. apk 還原模擬器環境 ¨ C: Documents and Settings使用者帳號目錄Local SettingsApplication DataAndroiduserdata. img

Android SDK 下載處 http: //developer. android. com/sdk/1. 5_r 2/index. html

Android SDK 下載處 http: //developer. android. com/sdk/1. 5_r 2/index. html

Android SDK n Googel Android SDK包括以下幾個部份 ¨ Android平台Linux作業系統 ¨ Android模擬器 ¨ Eclipse圖形開發環境 ¨ Android

Android SDK n Googel Android SDK包括以下幾個部份 ¨ Android平台Linux作業系統 ¨ Android模擬器 ¨ Eclipse圖形開發環境 ¨ Android Development Tools (ADT) ¨ 函式庫 ¨ API ¨ Sample n Code 目前大致分為 1. 1版及1. 5版

Android平台Linux作業系統 n n n n Android Linux Kernel是以Linux 2. 6 kernel修改而 來. Android SDK

Android平台Linux作業系統 n n n n Android Linux Kernel是以Linux 2. 6 kernel修改而 來. Android SDK 1. 1版為 2. 6. 25版本 CPU為ARM架構 目前釋出手機(T-Mobile G 1)使用Qualcomm 528 MHz處理器及256 MB ROM與192 MB RAM Android Linux Kernel 原始碼修改可至 ¨ http: //android. git. kernel. org Android 軟體副檔名為. apk, 可以使用adb進行安 裝. 可至Android Market購買軟體

Android模擬器 n n n 使用x 86平台模擬 ARM處理器 提供遠端telnet至模 擬器, 發送訊息至手機。 提供adb除錯功能 (Android Debug Bridge)

Android模擬器 n n n 使用x 86平台模擬 ARM處理器 提供遠端telnet至模 擬器, 發送訊息至手機。 提供adb除錯功能 (Android Debug Bridge) n DDMS (Dalvik Debug Monitor Service)

模擬器執行方式 n 需先將%android%tools路徑加至%path% 之中 ¨ Android 1. 1版 開啟Console, 鍵入emulator –skin HVGA-P ¨ Android

模擬器執行方式 n 需先將%android%tools路徑加至%path% 之中 ¨ Android 1. 1版 開啟Console, 鍵入emulator –skin HVGA-P ¨ Android 1. 5版 先建立AVD (Android Virtural Device) 開啟console, 鍵入 android create avd --target 2 --name <%name%> Emulator –avd <%name%>

簡單指令介紹 n ADB (Android Debug Bridge) ¨ adb shell (同Linux console) ¨ adb install

簡單指令介紹 n ADB (Android Debug Bridge) ¨ adb shell (同Linux console) ¨ adb install (adb install Hunter. apk) ¨ adb push / pull (adb push 1. jpg /sdcard) ¨ adb device n DDMS (Dalvik Debug Monitor Service) ¨ 效能監管, n Android檔案管理, 畫面擷取 telnet rm, cd等等) ¨ 模擬Android執行環境, (撥打電話, 簡訊傳送, GPS, 網 路, 網路資料轉向) ¨ 執行基本操作指令(ls,

語言環境簡介 n Android開發使用Java語言, 但Virtual Machine卻是自己Porting的版本, 而非使用 Sun官方版本. 包含以下兩個核心 ¨ Core Libraries ¨ Dalvik Virtual

語言環境簡介 n Android開發使用Java語言, 但Virtual Machine卻是自己Porting的版本, 而非使用 Sun官方版本. 包含以下兩個核心 ¨ Core Libraries ¨ Dalvik Virtual Machine Java SRC Compile Sun Runtime (Virtual Machine) Java Bytecode Dalvik Bytecode (. dex) Dalvik Runtime (Virtual Machine)

開始撰寫: Android Building Blocks n Android. Manifest. xml ¨ ¨ n Activity ¨ n

開始撰寫: Android Building Blocks n Android. Manifest. xml ¨ ¨ n Activity ¨ n 對外部的事件做些處理 ,如:電話響時,網路資料可以使用時,或半夜來臨時。Broadcast Intent Receiver它並不能拿來顯示UI畫面,它必需利用Notification. Manager來通知使用者他們感興趣的事 件發生了。 Service ¨ n 每個Activity都會實作出一個類別,而且這個類別是繼承自Activity這個基礎類別。 Broadcast Intent Receiver ¨ n 所有你在應用程式裡面會用到的最高階定義,得在這邊先行描述 。以下為一個activity的範例: <? xml version="1. 0" encoding="utf-8"? > <manifest xmlns: android="http: //schemas. android. com/apk/res/android" package="com. my_domain. app. helloactivity"> <application android: label="@string/app_name"> <activity android: name=". Hello. Activity"> <intent-filter> <action android: name="android. intent. action. MAIN"/> <category android: name="android. intent. category. LAUNCHER"/> </intent-filter> </activity> </application> </manifest> Service就是一段程式,它並沒有UI呈現畫面,但它可以長期的存在系統內執行。 例如持續撥歌的服 務 Content Provider ¨ 可以將它們的資料儲存起來到一個檔案,存到SQLite資料庫,或其它的機制儲存起來。 達到資料共 享。

Android Application Android 軟體副檔名為. apk, 可以使用adb進 行安裝. n 可至Android Market購買軟體 n

Android Application Android 軟體副檔名為. apk, 可以使用adb進 行安裝. n 可至Android Market購買軟體 n

Android Project n 在Eclipse開啟一個新的Android Project後,包含以下檔案結構 ¨ Android. Manifest. xml Android project設定 ¨ src/ (java原始檔)

Android Project n 在Eclipse開啟一個新的Android Project後,包含以下檔案結構 ¨ Android. Manifest. xml Android project設定 ¨ src/ (java原始檔) ¨ res/anim (動畫設定檔) ¨ res/drawable/ (應用程式圖檔) ¨ res/layout (視窗佈局檔) ¨ res/values (字串定義檔, 顏色定 義檔)

Android Application Lifecycle 1. Foreground process(前景模式) 正在運行的程式 2. visible process(可 見模式) - 畫面變透明 時

Android Application Lifecycle 1. Foreground process(前景模式) 正在運行的程式 2. visible process(可 見模式) - 畫面變透明 時 3. Background process(背景模式) 4. empty process(空 白模式) 5. service process(服 務模式)

Android模擬器-觀看應用程式展示 n n n 使用x 86平台模擬 ARM處理器 提供遠端telnet至模 擬器, 發送訊息至手機。 提供adb除錯功能 (Android Debug Bridge)

Android模擬器-觀看應用程式展示 n n n 使用x 86平台模擬 ARM處理器 提供遠端telnet至模 擬器, 發送訊息至手機。 提供adb除錯功能 (Android Debug Bridge) n DDMS (Dalvik Debug Monitor Service)

模擬器執行方式 n 需先將%android%tools路徑加至%path% 之中 ¨ Android 1. 1版 開啟Console, 鍵入emulator –skin HVGA-P ¨ Android

模擬器執行方式 n 需先將%android%tools路徑加至%path% 之中 ¨ Android 1. 1版 開啟Console, 鍵入emulator –skin HVGA-P ¨ Android 1. 5版 先建立AVD (Android Virtural Device) 開啟console, 鍵入 android create avd --target 2 --name <%name%> Emulator –avd <%name%>

關鍵指令介紹 n ADB (Android Debug Bridge) ¨ adb shell (同Linux console) ¨ adb install

關鍵指令介紹 n ADB (Android Debug Bridge) ¨ adb shell (同Linux console) ¨ adb install (adb install Hunter. apk) ¨ adb push / pull (adb push 1. jpg /sdcard) ¨ adb device n DDMS (Dalvik Debug Monitor Service) ¨ 效能監管, n Android檔案管理, 畫面擷取 telnet rm, cd等等) ¨ 模擬Android執行環境, (撥打電話, 簡訊傳送, GPS, 網 路, 網路資料轉向) ¨ 執行基本操作指令(ls,

情境 step 1

情境 step 1

情境 step 2

情境 step 2

情境 step 3

情境 step 3

情境 step 4

情境 step 4