Published on

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. Android Mandus Elfving, IBS JavaSolutions, 2009
  2. 2. What is Android? • Operating system and platform for mobile devices • Developed by Google and later by the Open Source Handset Alliance • Mostly open sourced under the Apache and other open source licenses
  3. 3. Android features • 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)
  4. 4. Architecture
  5. 5. Why is Android interesting to us? Application development is done in Java!
  6. 6. Dalvik Virtual Machine • Optimized for mobile devices • Relies on the underlying OS for process separation, memory management and threading • Designed to run multiple VM instances efficiently • Executes its own type of byte code in files created from Java class files
  7. 7. Android vs. Java • Based on Apache Harmony • Supports most of the J2SE 5.0 library • Applets, printing and other irrelevant stuff left out • Includes third party libraries, e.g. bluetooth and JSON libraries
  8. 8. Applications • Comes in .apk files which contain the application code and resources • Run in their own Linux process • Each process has its own VM • Applications are assigned a unique user id that make sure that application data is private
  9. 9. Application building blocks • Applications consist of components that are the entry points of an application • Applications can use components from other applications • Four types of components: • Activities • Services • Broadcast receivers • Content providers
  10. 10. Application Building Blocks con't Components declared in AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="" package=""> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name="HelloWorldActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
  11. 11. Activities • Interface for one of the activities that a user undertake in an application • Applications are (usually) built from multiple activities • The UI for an activity is built with Views
  12. 12. Services • Used for long running background processes, e.g. media player • Can run on its own in the background and/or be operated by an interface • Run in the main thread of the application process • Spawn thread to not block main thread
  13. 13. Broadcast receivers • Components that react to system or application broadcasts • System broadcasts for example when the battery level is low or the timezone changed • Applications can initiate broadcasts that other applications can react to
  14. 14. Content providers • Application data is by default private to the application • Content providers make an applications private data available to other applications through a standardized API • Accessed through a ContentResolver with an URI of the content provider to use, e.g. content://com.example.addressbook/contacts • Android ships with standard content providers for common data types (audio, video, contacts, etc.)
  15. 15. Application navigation • Components are activated by intents • Intents are asynchronous messages • Intents contain information relevant to the receiving component, e.g. action to take and data to act on • Also contain information that the system use for finding the component that should handle it
  16. 16. Application navigation con't • Components can be targeted explicitly or implicitly • Intent filters define that a component can handle a specific implicit intents • The system locates the best component to respond to an implicit intent • Intent filters are defined in the manifest file
  17. 17. Application life cycle • Tasks are groups of related activities arranged in a stack • Tasks can be sent to the background or moved to the foreground • Only one task and activity running at the same time
  18. 18. Application life cycle con't • When system runs low on memory applications can be killed • All applications are placed in an “importance hierarchy” to determine which application to kill next • Importance is based on the components running in an application and their state
  19. 19. Application framework • Consists of a set of services and systems to help in application development • For example used to support localized applications and to build the graphical UI • Used by core applications such as the SMS and Contacts applications
  20. 20. Views
  21. 21. Resource manager • Provides access to non-code related resources such as localized strings or graphics • Resources are compiled in to the application binary (resources reside in the res/ folder) • Used by referencing symbols that are generated when the application is compiled (available in the R class), e.g. R.string.app_name or @string/app_name
  22. 22. Notification manager • Allows the application to notify the user when something has happened in the background • Different kinds: • Icon in the status bar • LEDs on the device • Flashing backlight, playing a sound or vibrating
  23. 23. Security • Applications are signed with a certificate • Applications run in their own process with a unique user id • Permissions restrict access to the data on the device • Permissions granted by user on installation of application • Permissions that application need and declaration of custom permissions is done in the application manifest file
  24. 24. Development environment • Android SDK • Command-line tools • Eclipse with an Android plugin • Execution/debugging in an emulator running the full OS and software stack
  25. 25. Phones • First phone released October 2008 by T-mobile in the US and UK • New phones during 2009 from the large phone companies
  26. 26. More information at: