. Module 1: Android Overview M.Sc. Bui Tan Loc btloc@fit.hcmus.edu.vn
Department of Software Engineering, Faculty of Information Technology, University of Science Ho Chi Minh City, Viet Nam Android Basic Course 2012 University of Science HCM City . Objectives After completing this module, you will have learned: Android Features About Android Architecture/Android software stack That the Android SDK includes developer tools, APIs, and comprehensive documentation About types of Android applications About Android application component model About Android application building blocks
2 Android Basic Course 2012 University of Science HCM City . Contents What is Android? Why Android? Features Android Architecture/Android Software Stack Overview of the Android development environment Types of Android applications Android application components Android application component model Android application building blocks Android design guidelines 3 Android Basic Course 2012 University of Science HCM City . What is Android? Android is a software stack for mobile devices that includes an operating system, middleware and key applications. The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language. 4 Android Basic Course 2012 University of Science HCM City . Why Android? Listen from the project creators/developers (2.19 min) Nick Sears. Co-founder of Android Steve Horowitz. Engineering Director Dam Morrill. Developer Peisun Wu. Engineering Project Manager Erick Tseng. Project Manager Iliyan Malchev. Engineer Mike Cleron. Software Manager Per Gustafsson. Graphics Designer. etc
http://youtu.be/6rYozIZOgDk
You will hear statements such as currently it is too difficult to make new products open software brings more innovation choices lower costs more applications such as family planner, my taxes, understand my wife better,
5 Android Basic Course 2012 University of Science HCM City . Android vs. Competitors 04/2011 6 0 100,000 200,000 300,000 400,000 500,000 600,000 Symbian Android Research In Motion iOS Microsoft Other Operating Systems 2010 2011 2012 2015 http://www.gartner.com/it/page.jsp?id=1622614 Android Basic Course 2012 University of Science HCM City . Features Application framework enabling reuse and replacement of components Dalvik virtual machine optimized for mobile devices Integrated browser based on the open source WebKit engine Optimized graphics powered by a custom 2D graphics library; 3D graphics based on the OpenGL ES 1.0 specification (hardware acceleration optional) SQLite for structured data storage Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF) GSM Telephony (hardware dependent) Bluetooth, EDGE, 3G, and WiFi (hardware dependent) Camera, GPS, compass, and accelerometer (hardware dependent) Rich development environment including a device emulator, tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE 7 Android Basic Course 2012 University of Science HCM City . Android Architecture/Android Software Stack Java C++ Kernel 8 Android Basic Course 2012 University of Science HCM City . Applications All applications, both native and third-party, are built on the application layer by means of the same API libraries. The application layer runs within the Android run time, using the classes and services made available from the application framework. Applications = Native Apps + Third-Party Apps + Developer Apps 9 Android Basic Course 2012 University of Science HCM City . Application Framework The application framework provides the classes used to create Android applications. It also provides a generic abstraction for hardware access and manages the user interface and application resources. The application framework that lets you produce a replacement contact manager or phone dialer can let you expose your application components to let other developers create new UI front ends and functionality extensions, or otherwise build on them thanks to Android Application Architecture. 10 Android Basic Course 2012 University of Science HCM City . Android Application Architecture Android Application Architecture is a set of services and systems, including: Activity Manager: Controls the life cycle of your Activities, including management of the Activity stack. Views: Used to construct the user interfaces for your Activities. Notication: Manager Provides a consistent and nonintrusive mechanism for signaling your users. Content Providers: Let your applications share data. Resource Manager: Supports non-code resources like strings and graphics to be externalized. 11 Android Basic Course 2012 University of Science HCM City . Android Libraries Android includes a set of C/C++ libraries such as: A media library for playback of audio and video media. A surface manager to provide display management. Graphics libraries that include SGL and OpenGL for 2D and 3D graphics. SQLite for native database support. SSL and WebKit for integrated web browser and Internet security. 12 Android Basic Course 2012 University of Science HCM City . Android Runtime What makes an Android phone an Android phone rather than a mobile Linux implementation is the Android run time. Including the core libraries and the Dalvik virtual machine, the Android run time is the engine that powers your applications and, along with the libraries, forms the basis for the application framework. 13 Android Basic Course 2012 University of Science HCM City . Android Runtime Core libraries: While Android development is done in Java, Dalvik is not a Java VM. The core Android libraries provide most of the functionality available in the core Java libraries as well as the Android-specic libraries. Dalvik virtual machine: Dalvik is a register-based virtual machine thats been optimized to ensure that a device can run multiple instances efciently. It relies on the Linux kernel for threading and low-level memory management. 14 Android Basic Course 2012 University of Science HCM City . Linux Kernel Core services (including hardware drivers, process and memory management, security, network, and power management) are handled by a Linux 2.6 kernel. The kernel also provides an abstraction layer between the hardware and the remainder of the stack. 15 Android Basic Course 2012 University of Science HCM City . Overview of the Android development environment Supported OS: Windows, Mac OS X, Linux Pre-requirement: JDK 1. Installing Editor: Eclipse (Eclipse classic version is recommended) 2. Installing SDK Starter Package (SDK Manager): Note that you need to refer to the SDK directory (In Windows OS, this called set path) 3. Installing ADT plugin for Eclipse: Configuring Eclipse to work with SDK Manager 4. Using SDK Manager to add platforms and other components: SDKs, documents, sample source codes, etc.
16 Android Basic Course 2012 University of Science HCM City . Overview of Android SDK versions 17 Platform Version API Level VERSION_CODE Notes Android 4.0 14 ICE_CREAM_SANDWICH Platform Highlights Android 3.2 13 HONEYCOMB_MR2 Android 3.1.x 12 HONEYCOMB_MR1 Platform Highlights Android 3.0.x 11 HONEYCOMB Platform Highlights Android 2.3.4 Android 2.3.3 10 GINGERBREAD_MR1 Platform Highlights Android 2.3.2 Android 2.3.1 Android 2.3 9 GINGERBREAD Android 2.2.x 8 FROYO Platform Highlights Android 2.1.x 7 ECLAIR_MR1 Platform Highlights Android 2.0.1 6 ECLAIR_0_1 Android 2.0 5 ECLAIR Android 1.6 4 DONUT Platform Highlights Android 1.5 3 CUPCAKE Platform Highlights Android 1.1 2 BASE_1_1 Android 1.0 1 BASE Android Basic Course 2012 University of Science HCM City . Types of Android applications 1. Foreground: An application thats useful only when its in the foreground and is effectively. 2. Background: An application with limited interaction that, apart from when being congured, spends most of its lifetime hidden: Ex: SMS apps 3. Intermittent: Expects some interactivity but does most of its work in the background. Ex: chat, email apps 4. Widget: Some applications are represented only as a home-screen widget. Ex: clock, weather apps 18 Android Basic Course 2012 University of Science HCM City . Android application package Android applications are written in Java. An Android application is bundled by the aapt tool into an Android package (.apk) .apk Java Code
Data Files Resources Files res/layout: declaration layout files res/drawable: intended for drawing res/admin: bitmaps, animations for transitions res/values: externalized values strings, colors, styles, etc res/xml: general XML files used at runtime res/raw: binary files (e.g. sound) 19 Android Basic Course 2012 University of Science HCM City . Android application components 1. Activities (user interaction): UI component typically corresponding to a screen. Ex: any screen. 2. Services (service provider): Background process without UI Ex: mp3 player. Messages can be sent from and to a service. 3. Content Providers (data provider): Enables applications to share data Ex: Contacts are provided to all applications. 4. Broadcast Receivers (system event listener): Responds to external events, can wake up your process Ex: Phone rings, network activity established, time controlled. 20 Android Basic Course 2012 University of Science HCM City . The Android application manifest Each Android project includes a manifest le, AndroidManifest.xml, stored in the root of the project hierarchy. The manifest lets you dene the structure and metadata of your application, its components, and its requirements. It includes nodes for each of the components (Activities, Services, Content Providers, and Broadcast Receivers) that make up your application and, using Intent Filters and Permissions, determines how they interact with each other and with other applications. 21 Android Basic Course 2012 University of Science HCM City . Android application component model Application (.apk) Process Activity Activity Activity Activity Content Provider Service Service Broadcast Receiver Intent Result Remote Method(AIDL) Query/cursor Broadcast Intent 22 Android Basic Course 2012 University of Science HCM City . Android application building blocks Android application building blocks = Android application components + Intents + Widgets + Notifications 5. Widgets: Visual application components that can be added to the home screen. A special variation of a Broadcast Receiver, widgets let you create dynamic, interactive application components for users to embed on their home screens 6. Notifications: Notifications let you signal users without stealing focus or interrupting their current Activities. Theyre the preferred technique for getting a users attention from within a Service or Broadcast Receiver. 23 Android Basic Course 2012 University of Science HCM City . Android application building blocks 7. Intents (Activating Components): An inter-application message-passing framework. Using Intents you can broadcast messages system-wide or to a target Activity or Service, stating your intention to have an action performed. Three of the four component typesactivities, services, and broadcast receiversare activated by an asynchronous message called an intent. 24 Android Basic Course 2012 University of Science HCM City . Android design guidelines In many ways, designing an Android application is the same as designing for any other mobile app. Android applications follow the same user experience rules that all mobile applications should follow. When you develop Android applications, you should follow the Android design guidelines. This is important when you want to publish your applications on Android Market. 25 Android Basic Course 2012 University of Science HCM City . Questions or Discussions Why do people say about Android: java, but not java? Linux, but not Linux? More capabilities with native libraries?
26 Android Basic Course 2012 University of Science HCM City . References & Further readings Android Basics: http://developer.android.com/guide/basics/what-is-android.html http://developer.android.com/guide/topics/fundamentals.html Installing the SDK: http://developer.android.com/sdk/installing.html Android API Levels: http://developer.android.com/guide/appendix/api-levels.html Android application model: http://gcu.googlecode.com/files/android_application_model.ppt Android design guidelines: http://www.mobilemarketer.com/cms/lib/12061.pdf http://developer.android.com/guide/practices/ui_guidelines/index. html 27 Android Basic Course 2012 University of Science HCM City . References & Further readings Professional Android 2 Application Development, Reto Meier, Wiley Publishing (2010) Introducing the Development Framework, Chapter 1 Types of Android Applications, Chapter 2 What Makes an Android Application, Chapter 3