Chapter 1 Hello, Android
Transcription
Chapter 1 Hello, Android
Chapter 1 Hello, Android OPEN HANDSET ALLIANCE OPEN HANDSET ALLIANCE OPEN HANDSET ALLIANCE A commitment to openness, a shared vision for the future, and concrete plans to make the vision a reality. To accelerate innovation in mobile and offer consumers a richer, less expensive, and better mobile experience. (http://www.openhandsetalliance.com) Android Devices in the Market Smartphones Tablets E-reader devices Netbooks MP4 players Internet TVs Android Devices Android Devices For More Pictures on https://www.facebook.com/MobileComputingAndroid What Is Android? Google’s Andy Rubin describes Android as: The first truly open and comprehensive platform for mobile devices, all of the software to run a mobile phone but without the proprietary obstacles that have hindered mobile innovation. (http://googleblog.blogspot.com/2007/11/wheres-mygphone.html) What Is Android? A software platform and operating system for mobile devices Based on the Linux kernel Developed by Google and later the Open Handset Alliance (OHA) Allows writing managed code in the Java language Possibility to write applications in other languages and compiling it to ARM native code (support of Google? No) Unveiling of the Android platform was announced on 5 November 2007 with the founding of OHA What Is Android? Android is made up of several necessary and dependent parts : A hardware reference design. A Linux operating system kernel. Open-source libraries for application development. A run time used to execute and host Android applications. An application framework. A user interface framework. Preinstalled applications. A software development kit. Performance Security Android is a multi-process system, in which each application (and parts of the system) runs in its own process. Most security between applications and the system is enforced at the process level through standard Linux facilities, such as user and group IDs that are assigned to applications. Additional finer-grained security features are provided through a "permission" mechanism that enforces restrictions on the specific operations that a particular process can perform, and per-URI permissions for granting ad-hoc access to specific pieces of data. Future possibilities Google Android Sales to Overtake iPhone in 2012 The OHA is committed to make their vision a reality: to deploy the Android platform for every mobile operator, handset manufacturers and developers to build innovative devices Intel doesn’t want to lose ownership of the netbook market, so they need to prepare for anything, including Android Fujitsu launched an initiative to offer consulting and engineering expertise to help run Android on embedded hardware, which aside from cellphones, mobile internet devices, and portable media players, could include GPS devices, thin-client computers and set-top boxes. More Android devices are coming and some will push the envelope even further NATIVE ANDROID APPLICATIONS An e-mail client An SMS management application A full PIM A WebKit-based web browser A music player and picture gallery A camera and video recording application A calculator The home screen An alarm clock SDK Android APIs, Full Documentation and Sample code Development tools Dalvik Debug Monitor Service (DDMS) Android Debug Bridge (ADB) Android Emulator Online support and blog Native Development Kit also available allows developers to implement parts of apps in native-code languages like C/C++ Plug in available to use Eclipse integrated development environment Developer forums and developer phones from Google, MOTODev studio from Motorola Features of Android Storage (Uses SQLite, a lightweight relational database, for data storage) Connectivity (Supports GSM/EDGE, IDEN, CDMA, EV-DO, UMTS, Bluetooth (includes A2DP and AVRCP), WiFi, LTE, and WiMAX) Messaging (Supports both SMS and MMS) Web browser (Based on the open-source WebKit, together with Chrome’s V8 JavaScript engine) Media support (Includes support for the following media: H.263, H.264 (in 3GP or MP4 container), MPEG-4 SP, AMR, AMR-WB (in 3GP container), AAC, HE-AAC (in MP4 or 3GP container), MP3, MIDI, Ogg Vorbis, WAV, JPEG, PNG, GIF, and BMP) Features of Android Con. Hardware support (Accelerometer Sensor, Camera, Digital Compass, Proximity Sensor, and GPS) Multi-touch (Supports multi-touch screens) Multi-tasking (Supports multi-tasking applications) Flash support (Android 2.3 supports Flash 10.1) Tethering (Supports sharing of Internet connections as a wired/wireless hotspot) Android Versions webpage link Data collected during a 14-day period ending on May 1, 2012 Android Software Stack Android Software Stack Linux kernel : This is the kernel on which Android is based. This layer contains all the low-level device drivers for the various hardware components of an Android device Libraries : 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 Android Software Stack Android run time : Core libraries : provide most of the functionality available in the core Java libraries as well as the Android-specific libraries. Dalvik virtual machine : a register-based virtual machine that’s been optimized to ensure that a device can run multiple instances efficiently. Application framework : Exposes the various capabilities of the Android OS to application developers so that they can make use of them in their applications. Applications : you will find applications that ship with the Android device(such as Phone, Contacts, Browser, etc.), as well as applications that you download and install from the Android Market. Any applications that you write are located at this layer The Dalvik Virtual Machine All applications written in Java and converted to the dalvik executable .dex Every android app runs its own process, with its own instance of the dalvik virtual machine. Not a traditional JVM, but a custom VM designed to run multiple instances efficiently on a single device. VM uses linux kernel to handle low-level functionality incl. security, threading, process and memory management. Android Application Architecture Rich, extensible set of Views apps can includes lists, grids, text boxes, buttons, web browser Content Providers allows data access from other applications or share own data Resource Manager access to localized strings, graphics, layout files Notification Manager enables custom alerts to be displayed in status bar Activity Manager Manages lifecycle of applications and provides navigation backstack Application Fundamentals Activities application presentation layer Services invisible components, update data sources, visible activities, trigger notifications perform regular processing even when app is not active or invisible Content Providers shareable data store Intents message passing framework broadcast messages system wide, for an action to be performed Broadcast receivers consume intent broadcasts lets app listen for intents matching a specific criteria like location Notifications ➤ Toast notification ➤ Status Bar Notification ➤ Dialog notification Applications All apps (native and 3rd party) are written using the same APIs and run on the same run time executable All apps have APIs for hardware access, location-based services, support for background services, map-based activities, 2D and 3D graphics. App Widgets are miniature app views that can be embedded in other apps like Home Screen App Priority and Processes Android apps do not have control over their own life cycles. Aggressively manages resources to ensure device responsiveness and kills process/apps when needed. Active Process – critical priority. Visible Process – high priority. Started Service Process. Background Process – low priority. Empty process. Compatibility Why? Allow customizable devices Create Common eco system Android compatibility is free and easy Obtain Android source code Comply with Android Compatibility Definition (ACD) doc List requirements that need to be met for devices to be compatible with a particular version on Android Pass the Compatibility Test Suite (CTS) Automated test harness running on desktop, manages test execution Test cases written, packaged as .apk to run on actual device or emulator Porting guide available for bringing up Android on custom HW Android Libraries Including a set of C/C++ libraries used by components of the Android system Exposed to developers through the Android application framework Android Libraries System C library - a BSD-derived implementation of the standard C system library (libc), tuned for embedded Linux-based devices Media Libraries - based on PacketVideo's OpenCORE; the libraries support playback and recording of many popular audio and video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG Surface Manager - manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applications Android Libraries LibWebCore - a modern web browser engine which powers both the Android browser and an embeddable web view SGL - the underlying 2D graphics engine 3D libraries - an implementation based on OpenGL ES 1.0 APIs; the libraries use either hardware 3D acceleration (where available) or the included, highly optimized 3D software rasterizer FreeType - bitmap and vector font rendering SQLite - a powerful and lightweight relational database engine available to all applications The Android market Google Market - Part of GMS apps 3rd party apps submitted to Google, approved and distributed through Market. Both Free and Paid apps. Apps now limited to 50 MB; updates possible through Market Monetization through ads available. Available in many countries, not all countries have support for paid apps. Other Market place applications available – Amazon has announced its own Android Market place. App searches filtered based on Manifest file (eg. if a device does not have trackball, apps using trackball will be filtered out). Every app publishes a list of components the app will access and permissions need to be granted before installation. Apps installed on device and SD card (SD Card from Froyo). Android vs. J2ME Multiple device configurations J2ME has 2 classes of micro devices Android offers only one Ease of understanding J2ME has multiple UI model (MIDlets, Xlets, AWT, Swing …) Android support for only one, so it would be more easier to understand than J2ME Android vs. J2ME Responsiveness Dalvik VM vs. JVM Dalvik VM vs. KVM Java compatibility Android runs .dex bytecode Runtime interpretation of Java bytecode is not possible Android vs. J2ME Adoption Most of mobile phone support for J2ME But uniformity, cost, ease of development in Android are the reasons for java developer to program for it Java SE support Android support for J2SE more complete than J2ME CDC (except AWT & Swing) Apple vs. Android Games 52.2% of app sales in 2010 350K apps in iStore, 130K in Android market (294K in may) Android easiest to write for Tools plus getting published Fragmented hardware Why Android For end users No license fee More than 30K application in the market with 61% are free apps Supported by dozens of hardware manufacturers Low price smart-phone devices Abilities to integrate with Google’s services Why Android Android Takes Lead in US Smartphone Market In January 2011, 31.2% of smartphone market, (7.1% in 2010), 30.4% Blackberry, and 24.7% iPhone http://www.comscoredatamine.com/2011/03/android-takes-leadin-u-s-smartphone-market/ Why? Publishing to the Market Requires Google Developer Account $25 fee Link to a Merchant Account Google Checkout Link to your checking account Google gets 30% you get 70% NEXT LECTURE CH2 We will be using Eclipse ➤ Set it up.