Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture Series on Android Programming Lecturer: Prof.Luqun Li Teaching Assistants: Fengyou Sun, Haijun Yang, Ting.

Similar presentations


Presentation on theme: "Lecture Series on Android Programming Lecturer: Prof.Luqun Li Teaching Assistants: Fengyou Sun, Haijun Yang, Ting."— Presentation transcript:

1 Lecture Series on Android Programming Lecturer: Prof.Luqun Li Teaching Assistants: Fengyou Sun, Haijun Yang, Ting Sun Chapter.1 Introducing the Android Computing Platform

2 Shanghai Normal University 2 Contents 1 1 What is Android ? 2 2 Brief History - Android 3 3 Delving into the Dalvik VM 4 4 Summary

3 Shanghai Normal University 3 What is Android ? An Open Handset Alliance Project An Open Source Mobile Phone OS Released by Google

4 Shanghai Normal University 4 What is Android? A software stack for mobile devices that i ncludes An operating system Middleware Key Applications Uses Linux to provide core system services Security Memory management Process management Power management Hardware drivers

5 Shanghai Normal University 5 Mobile Devices: Advantages Always with the user Typically have Internet access Typically GPS enabled Typically have accelerometer & com pass Most have cameras & microphones Many apps are free or low-cost

6 Shanghai Normal University 6 Mobile Devices: Disadvantages Limited screen size Limited battery life Limited processor speed Limited and sometimes slow network access Limited or awkward input: soft keyboa rd, phone keypad, touch screen, or sty lus Limited web browser functionality Range of platforms & configurations ac ross devices

7 Shanghai Normal University 7 Mobile Applications What are they? Any application that runs on a mobile device Types Web apps: run in a web browser HTML, JavaScript, Flash, server-side components, etc. Native: compiled binaries for the device Often make use of web services

8 Shanghai Normal University 8 Contents 1 1 What is Android ? 2 2 Brief History - Android 3 3 Delving into the Dalvik VM 4 4 Summary

9 Shanghai Normal University 9 Brief History - Android 2005 Google acquires startup Android Inc. to start Android plat form Work on Dalvik VM begins 2007 Open Handset Alliance announced Early look at SDK 2008 Google sponsors 1 st Android Developer Challenge T-Mobile G1 announced

10 Shanghai Normal University 10 Brief History cont SDK 1.5 (Cupcake) New soft keyboard with “autocomplete” feature SDK 1.6 (Donut) Support Wide VGA SDK 2.0/2.0.1/2.1 (Eclair) Revamped UI, browser 2010 Nexus One released to the public SDK 2.2 (Froyo) Flash support, tethering SDK 2.3 (Gingerbread) UI update, system-wide copy-paste

11 Shanghai Normal University 11 Contents 1 1 What is Android ? 2 2 Brief History - Android 3 3 Delving into the Dalvik VM 4 4 Summary

12 Shanghai Normal University 12 Delving into the Dalvik VM Google has spent a lot of time thinking a bout optimizing designs for low-powered handheld devices. Handheld devices lag behind their deskto p counterparts in memory and speed by eight to ten years. They also have limited power for comput ation; a handheld device’s total RAM mig ht be as little as 64MB, and its available space for applications might be as little a s 20MB.

13 Shanghai Normal University 13 Delving into the Dalvik VM First, the Dalvik VM takes the gener ated Java class files and combines t hem into one or more Dalvik Execut able (.dex) files. It reuses duplicate information from multiple class files, effectively reduc ing the space requirement (uncomp ressed) by half from a traditional.ja r file.

14 Shanghai Normal University 14 Delving into the Dalvik VM Second, Google has fine-tuned the garbage collection in the Dalvik VM, but it has chosen to omit a just-in-ti me (JIT) compiler, in this release at least. The company can justify this choice because many of Android’s core libr aries, including the graphics librarie s, are implemented in C and C++.

15 Shanghai Normal University 15 Delving into the Dalvik VM Finally, the Dalvik VM uses a differe nt kind of assembly-code generatio n, in which it uses registers as the p rimary units of data storage instead of the stack. Google is hoping to accomplish 30 p ercent fewer instructions as a result.

16 Shanghai Normal University 16 Understanding the Android Software Stack 用汉堡比喻 Android 平台架构 Android Architecture

17 Shanghai Normal University 17 用汉堡比喻 Android 平台架构

18 Shanghai Normal University 18 Architecture Phone Users App Developers Programmers Hardware Developers

19 Shanghai Normal University 19 Linux Kernel Works as a HAL (Hardware Abstraction Layer) Device drivers Memory management Process management Networking

20 Shanghai Normal University 20 Libraries C/C++ libraries Interface through Java (J2SE and not J2 ME) Surface manager – Handling UI Windows 2D and 3D graphics Media codecs, SQLite, Browser engine

21 Shanghai Normal University 21 Runtime Dalvik VM Dex files Compact and efficient than class files Limited memory and battery power Core Libraries Java 5 Std edition Collections, I/O etc…

22 Shanghai Normal University 22 Application Framework API interface Activity manager – manages application l ife cycle.

23 Shanghai Normal University 23 Applications Built in and user apps Can replace built in apps

24 Shanghai Normal University 24 Developing an End-User Application with the Android SDK You must know the concepts of: Activity Service Boardcast Receiver Content Provider

25 Shanghai Normal University 25 Application Building Blocks Activity Visible screen for user interaction Services Background services that tend to persist for a long time Broadcast Receivers Similar to interrupt handlers Content Providers Persistent data

26 Shanghai Normal University 26 Activities Typically present a visual interface to the user Owns a view that controls a rectangular window.But, they can: Be faceless Be in a floating window Return a value Supports child view derived from parents Maintains a history stack of all activities t hat are spawned in an application Eg: The “Calculator” app may have an activity that displays a numeric keyboard and buttons for numeric operations, etc. and awaits inputs from the user.

27 Shanghai Normal University 27 Android API – activity control loop 3 States essentially (see the colored ovals) Active or running Paused Stopped Call backs during sta te transition (see recta ngles)

28 Shanghai Normal University 28 Services Faceless components that run in the background E.g. A common example of a service is an m p3 player that may run in the background as the user may be involved with some activity of another app, e.g. web browser, network d ownload etc…

29 Shanghai Normal University 29 Services control loop Used in 2 ways Created by an activity and l eft running. Expose interfaces operated programmatically

30 Shanghai Normal University 30 Broadcast Receivers Broadcast receivers are similar to interru pt handlers in normal OS. BRs run in the background, listening for interrupts gene rated by other apps An application may have one or more BR ’ s to handle interrupts. Examples of interrupts: Incoming phone call User changed language setting Battery is low User has transited from one time zone to different one

31 Shanghai Normal University 31 Content Providers Content providers make some subset of an application ’ s data available to other a pps when requested E.g. address book, p hoto gallery Content providers are the only mechanis m for apps to share data across; there's no common storage area that all Android packages can access. Ships with common data types (audio, vi deo, images, personal contact informatio n, and so on)

32 Shanghai Normal University 32 Contents 1 1 What is Android ? 2 2 Brief History - Android 3 3 Delving into the Dalvik VM 4 4 Summary

33 Shanghai Normal University 33 Summary In this chapter, we wanted to pique your curiosi ty about Android. You saw how handhelds are becoming general-p urpose computing devices, and you got an over view of the Dalvik VM, which makes it possible t o run a complex framework on a constrained ha ndset. You explored Android’s software stack and got a taste of its programming concepts.

34 Shanghai Normal University 34 Homework 1.Browse 2.Download android SDK,eclips,ADT, Java, Motodev Studio for later use. 3.Compare anroid with Jave ME 4.Try some android mobile phone


Download ppt "Lecture Series on Android Programming Lecturer: Prof.Luqun Li Teaching Assistants: Fengyou Sun, Haijun Yang, Ting."

Similar presentations


Ads by Google