Android Development Introduction
Total Page:16
File Type:pdf, Size:1020Kb
8/24/2009 Android Development Introduction Victor Matos Cleveland State University Notes are based on: UlUnloc king AdAndro id by Frank Ableson, Charlie Collins, and Robi Sen. ISBN 978‐1‐933988‐67‐2 Manning Publications, 2009. & Android Developers http://developer.android.com/index.html 1 Chapter 1 ‐ Goals THE BIG PICTURE 1. What is Android? 2. Overview development environment 2 1 8/24/2009 Chapter 1 ‐ Resources Android’s web page http://www.android.com/ 3 What is Android? • Android is the software platform from Google and the Open HdtHandset Alliance tha t has the potential to revolutionize the global cell phone market. • It has the capability to make inroads in many other (non‐phone) embedded application markets. 4 2 8/24/2009 What is Android? • Android™ consists of a complete set of software components for mobile didevices including: – an operating system, – middleware, and – key mobile applications. 5 Why Android? Listen from the project creators/developers (2.19 min) – Nick Sears. Co‐founder of Android – Steve HitHorowitz. EiEngineer ing Direc tor – 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://www.youtube.com/watch?v=6rYozIZOgDk&eurl=http://www.android.com/about/&feature=player_embedd ed • 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, … ” 6 3 8/24/2009 What is Open Handset Alliance? • Quoting from www.OpenHandsetAlliance.com page • “… Open Handset Alliance™, a group of 47 technology and mobile companies have come together to accelerate innovation in mobile and offer consumers a richer, less expensive, and better mobile experience. • Together we have developed Android™, the first complete, open, and free mobile platform. • We are committed to commercially deploy handsets and services using the Android Platform. “ 7 Open Handset Alliance Members Operators Software Co. Commercializat. Semiconductor Handset Manf China Mobile Ascender Corp. Aplix Audience HTC China Unicom eBay Noser Engineering Broadcom Corp. LG KDDI Corp. Esmertec Astonishing Tribe Intel Corp. Motorola NTT DoCoMo Google Wind River Systems Marvell Tech. Samsung Sprint Nextel LivingImage Omron Software Group ASUSTek T‐Mobile NMS Comm. Teleca Nvidia Corp. Garmin Telecom Italia Nuance Comm. Qualcomm Huawei Tech Telefónica PacketVideo SiRF Tech. Holdings Sony Ericsson Vodafone SkyPop Synaptics Toshiba Softbank SONiVOX Texas Instr. Acer Ericsson Borqs AKM Semicond. ARM Atheros Comm. EMP 8 4 8/24/2009 See Android Developers http://www.youtube.com/watch?v=7Y4thikv‐OM Short video (4 min.) Show ing Dave BtBort and Dan Borstein, two members of the Android Open Source Project talk about the project. 9 The Android Platform Again, what did they say about Android? • Android is a software environment built for mobile devices. • It is not a hardware platform. • Android includes: • Linux kernel‐based OS, • a rich UI, • telephone functionality, • end‐user applications, • code libraries, • application frameworks, • multimedia support, ... • User applications are built for Android in Java. 10 5 8/24/2009 Android’s Context: Mobile Market Players $$$ Mobile network operators want to lock down their networks, Operators controlling and metering traffic. Device manufacturers want to differentiate themselves with features, reliability, and price points. Device Software Manufacturers Vendors Software vendors want complete access to the hardware to deliver cutting‐edge applications. 11 The Maturing Mobile Experience Not so long ago …Today 1. Phone 1. Smartphone 2. Pager 2. Laptop (perhaps!) 3. PDA Organizer 4. Laptop 5. Portable music player 6. No Internet access / limited access Tomorrow ? 12 6 8/24/2009 Android vs. Competitors 1.Apple Inc. 2.Microsoft 3.Nokia 4.Palm 5.Research In Motion 6.Symbian 13 Android Components (Stack) • The Android stack includes a large array of ftfeatures for mobile applica tions. • It would be easy to confuse Android with a general purpose computing environment. • All of the major components of a computing platform are included. 14 7 8/24/2009 Android Components • 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 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 Teleppyhony (hardware depp)endent) • 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 15 Android Components 16 8 8/24/2009 Android Components Video 1/3: Android’s Architecture 17 Available at: http://www.youtube.com/watch?v=QBGfUs9mQYY Android Components Video 2/3: Application’s Life Cycle 18 Available at: http://www.youtube.com/watch?v=fL6gSd4ugSI&feature=channel 9 8/24/2009 Android Components Video 3/3: Android’s API Available at: http://www.youtube.com/watch?v=MPukbH6D‐lY&feature=channel 19 Android Application Framework Video: Inside the Android Application Framework (about 52 min) Presented by Dan Morrill – Google At Google Developer Conference San Francisco ‐ 2008 Available at: htt//ithttp://sites.goog le.com /it/i/i/site/io/ins ide‐the‐andiddroid‐applica tion‐fkframework Android is designed to be fast, powerful, and easy to develop for. This session will discuss the Android application framework in depth, showing you the machinery behind the application framework. explains the life‐cycle of an android apk. very good! 20 10 8/24/2009 Android Components Video: An Introduction to Android (about 52 min) Presented by Jason Chen – Google At Google Developer Conference San Francisco ‐ 2008 Available at: http: //www.you tu be.com /wa tc h?v=x 1ZZ‐R3p_w 8 21 Why use Linux for a phone? • Linux kernel is a proven core platform. • Reliability is more important than performance when it comes to a mobile phone, because voice communication is the primary use of a phone. • Linux can help meet this requirement. • Linux provides a hardware abstraction layer, letting the upper levels remain unchanged despite changes in the underlying hardware. • As new accessories appear on the market, drivers can be written at the Linux level to provide support, just as on other Linux platforms. 22 11 8/24/2009 Dalvik Virtual Machine • User applications, as well as core Android applications, are written in the Java programming language and are compiled into byte codes. • Android byte codes are interpreted at runtime by an interpreter known as the Dalvik virtual machine. 23 Why another JavaVirtual Machine? • Android bytecode files are logically equivalent to Java btbyteco des, btbut they permit AdAndro id to – run its applications in its own virtual environment that is free from Sun’s licensing restrictions and – an open platform upon which Google, and potentially the open source community, can improve as necessary. 24 12 8/24/2009 Dalvik Virtual Machine Video (61 min) DlikDalvik VM ItInterna ls Presented by Dan Borstein At Google Developer – 2008 San francisco Available at: http://www.youtube.com/watch?v=ptjedOZEXPM 25 Inside Android: Intents • An important and recurring theme of Android development is the Intent. • An Intent in Android describes what you want to do. • This may look like – “I want to look up a contact record,” or – “Please launch this website,” or – “Show the OdOrder CfiiConfirmation Screen.” • Intents are important because they facilitate navigation and represent the most important aspect of Android coding. 26 13 8/24/2009 Intents & IntentFilters • An Intent is a declaration of need. • An Intent is made up of various pieces including: desired action or service, data, and category of component that should handle the intent and instructions on how to launch a target activity. • An IntentFilter is a trigger, a declaration of capability and interest in offering assistance to those in need. • An IntentFilter may be generic or specific with respect to which Intents it offers to service. 27 Intents & IntentFilters • An intent is an abstract description of an operation to be performed. • Its most significant use is in the launching of activities, where it can be thought of as the glue between activities. • The primary pieces of information in an intent are: Action Data The general action to be The data to operate on, such as performed, such as: a person record in the contacts ACTION_VIEW, database, expressed as a Uri. ACTION_EDIT, ACTION_MAIN, etc. 28 14 8/24/2009 Intents & IntentFilters Some examples of Intent’s action/data pairs are: ACTION_VIEW content://contacts/1 ‐‐ Display information about the person whose identifier is "1". ACTION_DIAL content://contacts/1 ‐‐ Display the phone dialer with the person filled in. ACTION_VIEW tel:123 ‐‐ Display the phone dialer with the given number filled in ACTION_DIAL tel:123 ‐‐ Display the phone dialer with the given number filled in. ACTION_EDIT content://contacts/1 ‐‐ Edit information about the person whose identifier is "1". ACTION_VIEW content://contacts/