Sie sind auf Seite 1von 55


Android is a software stack for mobile devices that includes an operating system, middleware and key applications. Android is a software platform and operating system for mobile devices based on the Linux operating system and developed by Google and the Open Handset Alliance. t allows developers to write managed code in a !ava"like language that utili#es Google"developed !ava libraries, but does not support programs developed in native code.

$he unveiling of the Android platform on % &ovember '(() was announced with the founding of the Open Handset Alliance, a consortium of *+ hardware, software and telecom companies devoted to advancing open standards for mobile devices. ,hen released in '((-, most of the Android platform will be made available under the Apache free"software and open"source license.

Android is a software stack for mobile devices that includes an operating system, middleware and key applications. Android is a software platform and operating system for mobile devices based on the Linux operating system and developed by Google and the Open Handset Alliance. t allows developers to write managed code in a !ava"like language that utili#es Google"developed !ava libraries, but does not support programs developed in native code. $he unveiling of the Android platform on % &ovember '(() was announced with the founding of the Open Handset Alliance, a consortium of *+ hardware, software and telecom companies devoted to advancing open standards for mobile devices. ,hen released in '((-, most of the Android platform will be made available under the Apache free"software and open"source license. THE BIRTH OF ANDROID Google Acquires Android Inc. n !uly '((%, Google ac.uired Android nc., a small startup company based in /alo Alto, 0A. Android1s co"founders who went to work at Google included Andy 2ubin 3co"founder of 4anger5, 2ich 6iner 3co"founder of ,ildfire 0ommunications, nc5, &ick 7ears 3once 8/ at $"6obile5, and 0hris ,hite 3one of the first engineers at ,eb$85. At the time, little was known about the functions of Android nc. other than they made software for mobile phones. At Google, the team, led by 2ubin, developed a Linux"based mobile device O7 which they marketed to handset makers and carriers on the premise of providing a flexible, upgradeable system. t was reported that Google had already lined up a series of hardware component and software partners and signaled to carriers that it was open to various degrees of cooperation on their part. Open Handse Alliance Founded

3 On % &ovember '((), the Open Handset Alliance, a consortium of several companies which include Google, H$0, ntel, 6otorola, 9ualcomm, $" 6obile, 7print &extel and &8 4 A, was unveiled with the goal to develop open standards for mobile devices. Along with the formation of the Open Handset Alliance, the OHA also unveiled their first product, Android, an open source mobile device platform based on the Linux operating system. Hard!are Google has unveiled at least three prototypes for Android, at the 6obile ,orld 0ongress on :ebruary ;', '((-. One prototype at the A26 booth displayed several basic Google applications. A 1d"pad1 control #ooming of items in the dock with a relatively .uick response. A prototype at the Google O conference on 6ay '-, '((- had a %'- 6H# 9ualcomm processor and a 7ynaptics capacitive touch screen, and used the <6$7 cellular standard. t had ;'- 6= of 2A6 and '%> 6= of flash, showing that Android1s memory re.uirements are reasonable. $he demo was carried out using a *.> 6bit?s H74/A connection.


Applica ion Fra$e!or% t is used to write applications for Android. <nlike other embedded mobile environments, Android applications are all e.ual, for instance, an applications which come with the phone are no different than those that any developer writes. $he framework is supported by numerous open source libraries such as openssl, 79Lite and libc. t is also supported by the Android core libraries. :rom the point of security, the framework is based on <& @ file system permissions that assure applications have only those abilities that mobile phone owner gave them at install time. Dal&i% 'ir ual (ac)ine t is extremely low"memory based virtual machine, which was designed especially for Android to run on embedded systems and work well in low power situations. t is also tuned to the 0/< attributes. $he 4alvik 86 creates a special file format 3.4A@5 that is created through build time post processing. 0onversion between !ava classes and .4A@ format is done by included BdxC tool. In egra ed Bro!ser Google made a right choice on choosing ,eb Dit as open source web browser. $hey added a two pass layout and frame flattening. $wo pass layout loads a page without waiting for blocking elements, such as external 077 or external !ava7cript and after a while renders again with all resources downloaded to the device. :rame flattening converts founded frames into single one and loads into the browser. $hese features increase speed and usability browsing the internet via mobile phone. Op i$i*ed Grap)ics As Android has '4 graphics library and *4 graphics based on OpenGL A7 ;.(, possibly we will see great applications like Google Aarth and spectacular games like 7econd Life, which come on Linux version. At this

5 moment, the shooting legendary *4 game 4oom was presented using

Android on the mobile phone. S+"i e Axtremely small 3E%((kb5 relational database management system, which is integrated in Android. t is based on function calls and single file, where all definitions, tables and data are stored. $his simple design is more than suitable for a platform such as Android. Handse "a,ou s $he platform is adaptable to both larger, 8GA, '4 graphics library, *4 graphics library based on OpenGL A7 ;.( specifications, traditional smart phone layouts. An underlying '4 graphics engine is also included. 7urface 6anager manages access to the display subsystem and seamlessly composites '4 and *4 graphic layers from multiple applications Da a S orage 79Lite is used for structured data storage .79Lite is a powerful and lightweight relational database engine available to all applications. Connec i&i , Android supports a wide variety of connectivity technologies including G76, 046A, =luetooth, A4GA, A84O, *G and ,i":i. (essaging 767, 667, and @6// are available forms of messaging including threaded text messaging. -e. Bro!ser $he web browser available in Android is based on the open"source ,ebDit application framework. t includes Lib,eb0ore which is a modern web browser engine which powers both the Android browser and an embeddable web view.

6 /a&a 'ir ual (ac)ine 7oftware written in !ava can be compiled into 4alvik bytecodes and executed in the 4alvik virtual machine, which is a speciali#ed 86 implementation designed for mobile device use, although not technically a standard !ava 8irtual 6achine. (edia Suppor Android will support advanced audio?video?still media formats such as 6/AG"+, H.'>+, 6/*, and AA0, A62, !/AG, /&G, G :. Addi ional Hard!are Suppor Android is fully capable of utili#ing video?still cameras, touchscreens, G/7, compasses, accelerometers, and accelerated *4 graphics. De&elop$en En&iron$en ncludes a device emulator, tools for debugging, memory and performance profiling, a plugin for the Aclipse 4A. $here are a number of hardware dependent features, for instance, a huge media and connections support, G/7, improved support for 0amera and simply G76 telephony. A great work was done for the developers to start work with Android using device emulator, tools for debugging and plugin for Aclipse 4A.

O0ERATION Android Run i$e Android includes a set of core libraries that provides most of the functionality available in the core libraries of the !ava programming language.Avery Android application runs in its own process, with its own instance of the 4alvik virtual machine. 4alvik has been written so that a device can run multiple 86s efficiently. $he 4alvik 86 executes files in the 4alvik Axecutable 3.dex5 format, which is optimi#ed, for minimal memory footprint. $he 86 is register"based, and runs

7 classes compiled by a !ava language compiler that have been transformed into the .dex format by the included FdxF tool. $he 4alvik 86 relies on the Linux kernel for underlying functionality such as threading and low"level memory management. 1.1.1. "inu2 3ernel

Android relies on Linux version '.> for core system services such as security, memory management, process management, network stack, and driver model. $he kernel also acts as an abstraction layer between the hardware and the rest of the software stack. t helps to manage security, memory management, process management, network stack and other important issues. $herefore, the user should bring Linux in his mobile device as the main operating system and install all the drivers re.uired in order to run it. 4evelopers have full access to the same framework A/ s used by the core applications. $he application architecture is designed to simplify the reuse of componentsG any application can publish its capabilities and any other application may then make use of those capabilities 3subHect to security constraints enforced by the framework5. $his same mechanism allows components to be replaced by the user. <nderlying all applications is a set of services and systems.

$he following diagram shows the maHor components of the Android operating system. Aach section is described in more detail below.

Figure4 Architecture Of Android "inu2 3ernel Android Architecture is based on Linux '.> kernel. t helps to manage security, memory management, process management, network stack and other important issues. $herefore, the user should bring Linux in his mobile device as the main operating system and install all the drivers re.uired in order to run it. Android provides the support for the 9ualcomm 676)D chipset family. :or instance, the current kernel tree supports 9ualcomm 676 )'((A chipsets, but in the second half of '((- we should see mobile

9 devices with stable version 9ualcomm 676 )'((, which includes maHor featuresI ,046A?H7</A and AG/27 network support =luetooth ;.' and ,i":i support 4igital audio support for mp* and other formats 7upport for Linux and other third"party operating systems !ava hardware acceleration and support for !ava applications 9camera up to >.( megapixels gpsOne J solution for G/7 and lots of other. "i.raries n the next level there are a set of native libraries written in 0?0KK, which are responsible for stable performance of various components. :or example, 7urface 6anager is responsible for composing different drawing surfaces on the mobile screen. t manages the access for different processes to compose '4 and *4 graphic layers. OpenGL A7 and 7GL make a core of graphic libraries and are used accordingly for *4 and '4 hardware acceleration. 6oreover, it is possible to use '4 and *4 graphics in the same application in Android. /acket 8ideo, one of the members of OHA, provided the media framework. t gives libraries for a playback and recording support for all the maHor media and static image files. :ree $ype libraries are used to render all the bitmap and vector fonts. :or data storage, Android uses 79Lite. As mentioned before, it is extra light rational management system, which locates a single file for all operations related to database. ,eb Dit, the same browser used by ApplesL 7afari, was modified by Android in order to fit better in a small si#e screens.

10 Android Run i$e At the same level there is Android 2untime, where the main component 4alvik 8irtual 6achine is located. t was designed specifically for Android running in limited environment, where the limited battery, 0/<, memory and data storage are the main issues. Android gives an integrated tool BdxC, which converts generated byte code from .Har to .dex file, after this byte code becomes much more efficient to run on the small processors.

Figure 4 0onversion from .Hava to .dex file As the result, it is possible to have multiple instances of 4alvik virtual machine running on the single device at the same time. $he 0ore libraries are written in !ava language and contains of the collection classes, the utilities, O and other tools. Applica ion Fra$e!or%

After that, there is Application :ramework, written in !ava language. t is a toolkit that all applications use, ones which come with mobile device like 0ontacts or 767 box, or applications written by Google and any Android developer. t has several components. $he Activity 6anager manages the life circle of the applications and provides a common navigation back stack for applications, which are running in different processes. $he /ackage 6anager keeps track of the applications, which are installed in the device. $he ,indows 6anager is !ava programming language abstraction on the top of lower level services that are provided by the 7urface 6anager.

11 $he $elephony 6anager contains of a set of A/ necessary for calling applications. 0ontent /roviders was built for Android to share a data with other applications, for instance, the contacts of people in the address book can be used in other applications too. $he 2esource 6anager is used to store locali#ed strings, bitmaps, layout file descriptions and other external partsof the application. $he 8iew 7ystem generates a set of buttons and lists used in < . Other components like &otification manager is used to customi#e display alerts and other functions.

Applica ion "a,er At the top of Android Architecture we have all the applications, which are used by the final user. =y installing different applications, the user can turn his mobile phone into the uni.ue, optimi#ed and smart mobile phone. All applications are written using the !ava programming language.



Applica ion Building Bloc%s ,e can think of an Android application as a collection of components, of various kinds. $hese components are for the most part .uite loosely coupled, to the degree where you can accurately describe them as a federation of components rather than a single cohesive application. Generally, these components all run in the same system process. t1s possible 3and .uite common5 to create multiple threads within that process, and it1s also possible to create completely separate child processes if you need to. 7uch cases are pretty uncommon though, because Android tries very hard to make processes transparent to your code. Google provides three versions of 74D for ,indows, for 6ac O7@ and one for Linux.$he developer can use Android plugin for Aclipse 4A or other 4As such as intelli!.:irst step for Android developer is to decompose the prospective application into the components, which are supported by the platform. $he maHor building blocks are theseI Activity ntent 2eceiver 7ervice 0ontent /rovider

Activity <ser interface component, which corresponds to one screen at time. t means that for the simple application like Address =ook, the developer should have one activity for displaying contacts, another activity component for displaying more detailed information of chosen name and etc. ntent 2eceiver

13 ,akes up a predefined action through the external event. :or example,for the application like Amail nbox, the developer should have intent receiver and register his code through @6L to wake up an alarm notification, when the user receives email. 7ervice A task, which is done in the background. t means that the user can start an application from the activity window and keep the service work, while browsing other applications. :or instance, he can browse Google 6aps application while holding a call or listening music while browsing other applications. 0ontent /rovider A component, which allows sharing some of the data with other processes and applications. t is the best way to communicate the applications between each other. Android will ship with a set of core applications including an email client, 767 program, calendar, maps, browser, contacts, and others. All applications are written using the !ava programming language.

Android(ani5es .2$l $he Android6anifest.xml file is the control file that tells the system what to do with all the top"level components 3specifically activities, services, intent receivers, and content providers described below5 you1ve created. :or instance, this is the FglueF that actually specifies which ntents your Activities receive. A developer should predefine and list all components, which he wants to use in the specific Android6anifest.xml file. t is a re.uired file for all the applications and is located in the root folder. t is possible to specify all global values for the package, all the components and its classes used, intent filters, which describe where and when the certain activity should start, permissions and instrumentation like security control and testing.


Here is an example of Android6anifest.xml fileI ;. MN xml versionOF;.(F encodingOFutf"-FNP '. Mmanifest xmlnsIandroidOFhttpI?? *. +. Mapplication androidIiconOFQdrawable?iconFP %. Mactivity classOF.HelloAndroidF androidIlabelOFQstring?appRnameFP >. Mintent"filterP ). Maction androidIvalueOFandroid.intent.action.6A &F ?P -. Mcategory androidIvalueOFandroid.intent.category.LA<&0HA2F?P S. M?intent"filterP ;(. M?activityP ;;. M?applicationP ;'. M?manifestP $he line ' is a namespace declaration, which makes a standard Android attributes available for that application. n the line + there is a single MapplicationP element, where the developer specifies all application level components and its properties used by the package. Activity class in the line % represents the initial screen the user sees and it may have one or more Mintent"filterP elements to describe the actions that activity supports. Applica ion "i5ec,cle n Android, every application runs in its own process, which gives better performance in security, protected memory and other benefits. $herefore, Android is responsible to run and shut down correctly these processes when it is needed. t is important that application developers understand how different application components 3in particular Activity, 7ervice, and =roadcast2eceiver5 impact the lifetime of the application1s process. &ot using these components correctly can result in the system killing the application1s process while it is doing important work.


$o determine which processes should be killed when low on memory, Android places each process into an Fimportance hierarchyF based on the components running in them and the state of those components. $hese process types are 3in order of importance5. ;. A foreground process is one that is re.uired for what the user is currently doing. 8arious application components can cause its containing process to be considered foreground in different ways. A process is considered to be in the foreground if any of the following conditions holdI i. ii. iii. t is running an Activity at the top of the screen that the user is interacting with 3its on2esume35 method has been called5. t has a =roadcast2eceiver that is currently running 3its =roadcast2eceiver.on2eceive35 method is executing5. t has a 7ervice that is currently executing code in one of its callbacks 37ervice.on0reate35, 7ervice.on7tart35, or 7ervice.on4estroy355. $here will only ever be a few such processes in the system, and these will only be killed as a last resort if memory is so low that not even these processes can continue to run. Generally, at this point, the device has reached a memory paging state, so this action is re.uired in order to keep the user interface responsive. '. A visible process is one holding an Activity that is visible to the user on" screen but not in the foreground 3its on/ause35 method has been called5. $his may occur, for example, if the foreground Activity is displayed as a dialog that allows the previous Activity to be seen behind it. 7uch a process is considered extremely important and will not be killed unless doing so is re.uired to keep all foreground processes running. *. A service process is one holding a 7ervice that has been started with the start7ervice35 method. $hough these processes are not directly visible to the user, they are generally doing things that the user cares about 3such as background mp* playback or background network data upload or download5, so the system will always keep such processes running unless there is not enough memory to retain all foreground and visible process.

16 +. A background process is one holding an Activity that is not currently visible to the user 3its on7top35 method has been called5. $hese processes have no direct impact on the user experience. /rovided they implement their Activity life"cycle correctly 3see Activity for more details5, the system can kill such processes at any time to reclaim memory for one of the three previous processes types. <sually there are many of these processes running, so they are kept in an L2< list to ensure the process that was most recently seen by the user is the last to be killed when running low on memory. %. An empty process is one that doesn1t hold any active application components. $he only reason to keep such a process around is as a cache to improve startup time the next time a component of its application needs to run. As such, the system will often kill these processes in order to balance overall system resources between these empty cached processes and the underlying kernel caches.


Figure 4 :lowchart 7howing $he Lifecycle Of An Activity

18 n the following example we will display a process flow from the Android 7ystem point of view to get a clear idea how the applications behave. Let assume the


/ossible scenarioI A user talks to his friend via mobile phone and he is asked to browse the internet 3a talk is hold for a moment5, find a picture of him in his /icasa Album, send it via Amail back to his friend and resume a talk. n this situation, there are + different applications and + different processes running, but from the user point of view none of them are important, as Android manages 0/< work and memory usage by itself. t means the user can travel through the applications forward and back without thinking about how much memory is left or which processes are run at the time.:irstly, as the user is talking to his friend, a specific $alk application is opened, which contains the activity manager. n the following stack we can see two processes running, the main system process and $alk application process. 6oreover, before going to ,eb =rowser application, the system saves a $alk state $ in order to remember that processI


19 At this point, as a user holds a talk and opens a web browser, the system creates a new process and new web browser activity is launched in it. Again, the state of the last activity is saved 3,5I

Figure After that, the user browses the internet, finds his picture in /icasa album and saves it to particular folder. He does not close a web browser, instead he opens a folder to find saved picture. $he folder activity is launched in particular processI

Figure At this point, the user finds his saved picture in the folder and he creates a re.uest to open an Amail application. $he last state : is saved. &ow assume that the mobile phone is out of the memory and there is no room to create a new process for Amail application. $herefore, Android looks to kill a process. t can not destroy :older process, as it was used previously and could be reused again, so it kills

20 ,eb =rowser process as it is not useful anymore and locates a new Amail process insteadI

Figure $he user opens Amail application and sends a picture to his friend via email. &ow he wants to go back to the $alk application and to resume a talk to his friend. =ecause of the previously saved states, this work is done fast and easily. n this example, Amail application is popped out and the user sees a previous :older applicationI

Figure &ext, the user goes back to ,eb =rowser application. <nfortunately, web browser process was killed previously so the system has to kill another process 3in our case it is Amail application process, which is not used

21 anymore5 in order to locate ,eb =rowser process and manage the stack memoryI

Figure and finallyI

Figure &ow the user comes back to the $alk application and resumes his talk with his friend.=ecause of the saved states, going back procedure is fast and useful, because it remembers previous activities and its views. $his example shows, that it does not matter how many applications and processes are active or how much available memory is left, Android it manages fast and without a user interaction.


Applica ion Fra$e!or% 4evelopers have full access to the same framework A/ s used by the core applications. $he application architecture is designed to simplify the reuse of componentsG any application can publish its capabilities and any other application may then make use of those capabilities 3subHect to security constraints enforced by the framework5. $his same mechanism allows components to be replaced by the user. <nderlying all applications is a set of services and systems, includingI ;. A rich and extensible set of 8iews that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser '. 0ontent /roviders that enable applications to access data from other applications 3such as 0ontacts5, or to share their own data *. A 2esource 6anager, providing access to non"code resources such as locali#ed strings, graphics, and layout files +. A &otification 6anager that enables all applications to display custom alerts in the status bar %. An Activity 6anager that manages the life cycle of applications and provides a common navigation backstack "i.rar, Android includes a set of 0?0KK libraries used by various components of the Android system. $hese capabilities are exposed to developers through the Android application framework. 7ome of the core libraries are listed belowI 7ystem 0 library " a =74"derived implementation of the standard 0 system library 3libc5, tuned for embedded Linux"based devices

23 6edia Libraries " based on /acket8ideo1s Open0O2AG the libraries support playback and recording of many popular audio and video formats, as well as static image files, including 6/AG+, H.'>+, 6/*, AA0, A62, !/G, and /&G 7urface 6anager " manages access to the display subsystem and seamlessly composites '4 and *4 graphic layers from multiple applications . Lib,eb0ore " a modern web browser engine which powers both the Android browser and an embeddable web view 7GL " the underlying '4 graphics engine *4 libraries " an implementation based on OpenGL A7 ;.( A/ sG the libraries use either hardware *4 acceleration 3where available5 or the included, highly optimi#ed *4 software rasteri#er :ree$ype " bitmap and vector font rendering 79Lite " a powerful and lightweight relational database engine available to all applications SOFT-ARE DE'E"O0(ENT $he feedback on developing applications for the Android platform has been mixed. ssues cited include bugs, lack of documentation, inade.uate 9A .$he first publicly available application was the 7nake game. So5 !are De&elop$en %i t includes development and debugging tools, a set of libraries, a device emulator, documentation, sample proHects, tutorials, and :A9s. 2e.uirements also include !ava 4evelopment Dit, Apache Ant, and /ython '.' or later. $he only officially supported integrated development environment 3 4A5 is Aclipse *.' or later, through the Android 4evelopment $ools /lugin, but programmers can use command line tools to create, build and debug Android applications.


0ar ial "is ing o5 Open Handse Alliance 0ar icipan s

Core Tec)nolog, 'endors

Figure SECURIT# ISSUES Android mobile phone platform is going to be more secure than AppleLs i/hone or any other device in the long run. $here are several solutions nowadays to protect Google phone from various attacks. One of them is security vendor 6cAfee, a member of Linux 6obile 3Li6o5 :oundation. $his foundation Hoins particular companies to develop an open mobile"device software platform. 6any of the companies listed in the Li6o :oundation have also become members of the Open Handset Alliance 3OHA5. As a result, Linux secure coding practice should successfully be built into the Android development process. However, open platform has its own disadvantages, such as source code vulnerability for black"hat hackers. n parallel with great opportunities for mobile application developers, there is an expectation for exploitation and harm. 7tealthy $roHans hidden in animated images, particular viruses passed from friend to friend, used for spying and identity theft, all these threats will be active for a long run. Another solution for such attacks is 76obile 7ystems mobile package. 7ecurity7hield Jan integrated application that includes anti"virus, anti"spam, firewall and other mobile protection is up and ready to run on the Android

25 operating system. 0urrently, the main problem is availability for viruses to pose as an application and do things like dialing phone numbers, sending text messages or multi"media messages or making connections to the nternet during normal device use. t is possible for somebody to use the G/7 feature to track a personLs location without their knowledge. Hence 76obile 7ystems is ready to notify and block these secure alerts. =ut the truth is that it is not possible to secure your mobile device or personal computer completely, as it connects to the internet. And neither the Android phone nor other devices will prove to be the exception.

CO(0ARISON Specula ions -i ) Cellular Carriers Google Android enters a tangled mess of cellular carrier world. As a new player in the mobile market, Android brings an open platform with the new rules. On the one hand there is OHA with maHor companies and carries, such as $"6obile and 7print. On the other hand, there are two largest cellular carries A$T$ and 8eri#on ,ireless in <nited 7tates, which have a vested interest in operating systems of their own. t is predictable,that 7print or $"6obile will be first carriers providing devices with Google Android. $his ensures e.ual development time for the networks, G76 side and 046A.=ut the main problem, which faces all the cellular carriers around the world, is the availability to download and use free applications that could block almost every communications product they sell. A user does not need to pay for G/7 mapping service anymore. He can simply download a free one that taps into Google 6aps. n fact,why pay for cellular minutes at all when a user can download 7kype, Gtalk or other client and Hust use his data planN O7Ls such as Android threaten carriers with a loss of control over the applications on the phones on their network and they may find themselves becoming nothing more than wireless nternet service providers, forced to compete on price and bandwidth.

26 Another aspect is hardware costI Google Android owns ;( percent of the total cost of a phone, which combined with falling hardware prices could eventually result a fertile unlocked handset market. n conclusion, Google has a better start in this race than any company had before to bring new rules to the mobile market with all carriers, mobile devices and its customers.

(anu5ac urers6 -ar /resently, Google main competitors like &okia, 6icrosoft and Apple do not see Google Android as a serious rival or threat to their business strategies. However, the current situation is not so unsophisticated. $here is a huge flurry in the companies, which are not in the list of OHA. :or instance, &okia, which is the largest handset manufacturer in the world, nowadays owning some *SU market share, was one of the companies snubbed on the invitation list to the *+"party Open Handset Alliance that is growing daily. n contrast, &okia is buying companies and dumping cash into development, while Google is releasing an open platform hoping the applications and services will build themselves with the help of a strong developer community, development contests and large alliance of grand companies. 4espite of this, &okia is ready to combat whatever Google has to throw with Google Android in '((-. Another company Apple has already stroked the market with i/hone and its closed operating system. Accordingly, i/hone in the <7 remains loyal to A$T$ mobile carrier for five years . $hat is plenty of time for Google to con.uer the market with open Android.Obvious advantage of Android is costI while i/hone is priced at a weighty V+((, Google says it hopes to reach a more mainstream market by pricing Android"powered devices at around V'((. 6icrosoft, selling ';

27 millions copies of ,indows 6obile software, stays calm at this point, waiting for some particular results from Google Android. $his nice and healthy competition is Hust what the mobile industry needs at the moment,at least for the consumers. $he wars being waged between Google and the field will onlycreate better, cheaper handsets and more advanced applications.

(ar%e Researc) A new generation of mobile device users is coming in the next decade. $hese users are going to explore the mobile internet afresh with its new features, compatible mobile phones, new services and applications. $his is a huge leap for mobile advertisement business, where revenue could rise - times more by '(;'. Google Android is going to present new solutions through the fast search engine, open source applications and other services. $he Delsey Group, which works with public opinion polls and statistics, published the results released October ;; '((),which say, that one hundred out of %((, or '( percent of people would be interested in purchasing a Google phone. 4espite the fact, that Google Android is in alpha version and it is unknown for the customers and mobile market, the results look promising. $he diagram below shows the study, which was conducted in 7eptember '(() via an online *(".uestion survey of %(( <.7. mobile phone users aged ;- and older. /eople do not find a good nternet experience in their phones today, so they are more interested in gravitating toward an nternet or technology company telephone


Figure because they think connectivity between devices and to the nternet is going to be much better on those phones. $hey use Google search, G6ail, Google 6aps, /icasa albums and other popular services on their computers, and this is what they expect to have in their mobile devices in the close future. (o.ile Ads !aiku " an activity stream and sharing service that works from the ,eb and mobile phones was bought by Google as important investment into the mobile advertisement./eople wondered why Google preferred the micro" blogging service to $witter, which is much more popular nowadays. $he answer lies in !aikuLs uni.ue ability to combine micro"blogging with userLs location. An integral part of the service is a !aiku client application for 7ymbian 7>( platform mobile phones, which should come to Android platform as well. $he client uses location A/ s within device to get the handset and the usersL location based on nearby cellular network towers. $hough the location is not very precise, the mobile phone is able to broadcast it automatically. At that point the text can be connected to usersL location and create a list of preferences for each place the user fre.uently visits.

29 <sing such a technology, it is simple to track down a user via phoneLs / address, whenever he comes into 6c4onald or is sitting in the airport.Google is not a million miles away from being able to push advanced advertising to individuals based on their profile, their location and their availability. $hey already offer regional and local targeting for ads for desktop users, but this could be much more useful for a mobile phone. And if the ads are truly relevant, interesting and unobtrusive, people might actually start to like them.

(o.ile Ser&ices Adding to its fast growing suite of mobile applications and services, Google has applied for a patent for a mobile payments service that would allow users to make payments at retail shops using their mobile phones. $he $ext 6essage /ayment patent describes a system where Google offers mobile focused payments called G/ay. $his describes a system where a 767 message would be sent containing a payment amount and other information. $hat payment amount would then be validated, debited from the user1s account, and communicated from server to server. /ayment confirmation that had been received would also simultaneously be sent to the relevant party, as illustrated in the diagram belowI

30 Figure 4 :igure describes GoogleLs mobile focused payments called G/ay

4escribed as Fa computer"implemented method of effectuating an electronic on"line payment,F the system mentioned in the patent application is similar to existing mobile payment services. $hese services like mobile version of /ay/al have been available for some time but have had little success bursting with merchants and with customers. $he main difference between existing mobile payment systems and G/ay is, of course, that G/ay is created by Google and will be easily adopted by Android /latform. $he more issues regarding Gpay are yet to be released. -)a $a%es Android special7 $here are already many mobile platforms on the market today, including 7ymbian, i/hone, ,indows 6obile, =lack=erry, !ava 6obile Adi"tion, Linux 6obile 3Li6o5, and more. ,hile some of its features have appeared before, Android is the Wrst environment that combinesI A truly open, free development platform based on Linux and open source. Handset makers like it because they can use and customi#e the platform without paying a royalty. 4evelopers like it because they know that the platform Bhas legsC and is not locked into any one vendor that may go under or be ac.uired. A component"based architecture inspired by nternet mash" ups. /artsof one application can be used in another in ways not originallyenvisioned by the developer. Xou can even replace built"in components with your own improved versions. $his will unleash a new round of creativity in the mobile space.

31 $ons of built"in services out of the box. Location based services use G/7 or cell tower triangulation to let you customi#e the user experience depending on where they are. A full"powered 79L database lets you harness the power of local storage for occasionally connected computing and synchroni#ation. =rowser and 6ap views can be embedded directly in your applications. All these built"in capabilities help to raise the bar on functionality while loweringyour development costs. Automatic management of the application life cycle. /rograms areisolated from each other by multiple layers of security, which will provide a level of system stability not seen before in smart phones.$he end user will no longer have to worry about what applications are active, or close some programs so that others can run. Android is optimi#ed for low"power, low" memory devices in a fundamental way that no previous platform has attempted. High .uality graphics and sound. 7mooth, anti"aliased '4 vector graphics and animation inspired by :lash is melded with *4 accelerated OpenGL graphics to enable new kinds of games and business applications. 0odecs for the most common industry standard audio and video formats are built right in, including H.'>+ 3A805, 6/*, and AA0. /ortability across a wide range of current and future hardware.All your programs are written in !ava and executed by AndroidLs 4alvik virtual machine so your code will be portable across A26,x->, and other architectures. 7upport for a variety of input methods is included such as keyboard, touch, tilt, camera, voice, and trackball. <ser interfaces can be customi#ed for any screen resolution and orientation.Android is a fresh take on the way mobile applications interact with users, along with the technical underpinnings to make it

32 possible. =ut the best part of Android is the software that you are going to write for it. $his book will help you get off to a great start.

Android And /a&a (E

!ava /latform, 6icro Adition or !ava 6A

3previously known as !ava '

/latform, 6icro Adition or !'6A5 is a specification of a subset of the !ava platform aimed at providing a certified collection of !ava A/ s for the development similaritiesI Aclipse plug"ins for !'6A and Android interface very well with their respective 74DsG =oth !'6A and Android seem to share the same core !ava A/ s, such as Hava.util and =ut their A/ s for graphics, < s, etc. are very dissimilar and philosophies for developing applications are very differentG Android seems to be more tightly integrated 3up to even the O7 services provided and how they interact with the A/ s5, while !'6A is far more liberal in its specifications for the developer and mobile device manufacturer. A slower application development and performance J these are the main disadvantages !ava1s !'6A have for today. !'6A apps are second"rate citi#ens in the phones. $hey do not have an access to most of the low"level features, like call A/ , external connectivity 3<7=5 and other. $here is no way to replace or extend built"in phone apps like contacts, calendar and calls. :or instance, !'6A applications in &okia devices with 7>( work great for standard tasks. =ut more advanced users find difficulties handling ,i":i look very similar and of software for small, resource"constrained devices. $hough, do not confuse it with Google Android, even there are some

33 access points with 7>(, because A/ s exposed to !'6A. A user may simply do not seem to be

find difficulties synchroni#ing Google

0alendar with his device " nobody seems to have been able to figure out how to make the !'6A calendar interfaces work correctly on 7>(. $here are lots of problems with !ava applications on 7>(, even though 7>( probably has one of the best !ava implementations. Android fills a void in !ava 6obile applications by providing A/ to build richer applications " more useful for 7mart /hones, which contain the ability to provide these types of functionalities. f !'6A filled every void, Android as an A/ wouldn1t be needed 3though Android as an O7 could still fill a void5. Google has written its own virtual machine for Android most likely as a way to get around licensing issues with 7un. However, Android does not include a complete and compliant !ava stack 3neither !6A nor !7A5G only a subset and therefore it is technically not the !ava platform, it Hust looks a lot like it. Openness O5 T)e 0la 5or$ $he open source school of thought implies that differentiation and competitive advantage come from innovation on top of the underlying platform rather than the platform itself. $he robustness and scalability of the platform is secured by the communityLs stewardship, and open access to a central repository of updated code. =eyond this, a strong third"party development environment and software development kit 374D5 are critical to attracting innovation. BOpenC is an invariably subHective term. 7ymbian and 6icrosoft can claim a degree of openness for their mobile platforms, for example, but ultimate control of A/ access and source code remains with a single entity. On the contrary, as Google has pointed out, thereLs nothing keeping any of the alliance members from using Android to build a XahooY Go phone. 6otorola has had some success delivering high"volume Linux"based devices such as the 6ing and 2AZ2 to market. =ut mobile Linux initiatives have failed to scale on the basis of attractiveness to third"party developersG

34 itLs been supply"push with the development focus in !ava 6A or other application framework components. mportantly, Android includes almost the entirety of the applications"related software stack, less key technical pieces such as telephony protocol stacks, which are left to silicon vendors. Android bundles critical components such as a Linux kernel from ,ind 2iver, various optimi#ed graphics engines, codecs, notification software, a Bclean roomC !86 implementation, and the DH$6L open source browser. $he latter forms the basis of AppleLs 7afari and &okiaLs 7>( offerings. Ad&an ages Open 8 Android allows you to access core mobile device functionality through standard A/ calls. All applications are e.ual 8 Android does not differentiate between the phone1s basic and third"party applications "" even the dialer or home screen can be replaced. =reaking down boundaries 8 0ombine information from the web with data on the phone "" such as contacts or geographic location "" to create new user experiences. :ast and easy development 8 $he 74D contains what you need to build and run Android applications, including a true device emulator and advanced debugging tools. Disad&an ages 7ecurity 8 6aking source code available to everyone inevitably invites the attention of black hat hackers. Open 7ource 8 A disadvantage of open"source development is that anyone can scrutini#e the source code to find vulnerabilities and write exploits.

35 Login 8 /latform doesn1t run on an encrypted file system and has a vulnerable log"in. ncompetence " GoogleLs dependence on hardware and carrier partners puts the final product out of their control.

Android has been critici#ed for not being all open"source software despite what was announced by Google. /arts of the 74D are proprietary and closed source, and some believe this is so that Google can control the platform. 7oftware installed by end"users must be written in !ava, and will not have access to lower level device A/ s. $his provides end"users with less control over their phone1s functionality than other free and open source phone platforms, such as Open6oko. ,ith all upcoming applications and mobile services Google Android is stepping into the next level of 6obile nternet. Android participates in many of the successful open source proHects. $hat is, architect the solution for participation and the developers will not only come but will play well together.

36 $his is notable contrast with Apple and other companies, where such architecture of participation is clearly belated. $he first Android based official devices may well be launched sometime in the early half of '((S. Obviously, that1s an age away when it comes to handset design, and Android may well find itself competing against the forthcoming &okia touch screen phones and maybe even the i/hone '.

;. '. *. +. %. >. ). -. httpI?? " Android Official ,ebpage httpI?? ,ebpage httpI?? ,ebpage httpI?? J Android ,iki httpI?? " Official Google =log httpI?? ,ikipedia nformation httpI?? httpI??,ebDit " Open Handset Alliance " Official Android Google 0ode

37 S. httpI??

;(. httpI??"android"dr"(-(';*



A & 42O 4
A& O/A& HA&47 A$ ALL A&0A /2O! A0$

8. 7 rinath ;(S;;A;'%*


o Android is a software stack for mobile devices that includes an o eratin! s"stem# middleware and ke" a lications$

Android is a software latform and o eratin! s"stem for mobile devices based on the %inu& o eratin! s"stem and develo ed b" 'oo!le and the ( en )andset Alliance$

o Allows develo ers to write mana!ed code in a *ava+like lan!ua!e that utili,es 'oo!le+develo ed *ava libraries# but does not su ort ro!rams develo ed in native code$




Android Runtime

Dalvik :
.alvik /0 is 'oo!le1s im lementation of *ava

( timi,ed for mobile devices 2e" .alvik differences3 4e!ister+based versus stack+based /0 .alvik runs $de& files 0ore efficient and com act im lementation .ifferent set of *ava libraries than 5.2


Anatomy of an Android Application

6here are four buildin! blocks for an Android a lication3 oActivity +a sin!le screen oIntent Receiver +to e&ecute in reaction to an e&ternal event78hone 4in!9 oService +code that is lon!+lived and runs without a :;70edia 8la"er9 oContent Provider +an a lication<s data to be shared with other a



Development Tools




!"# COD$ to UI D$SI%N

MresourcesP Mstring nameO"app_name"> S udoku</string> Mstring nameO"main_title"> Android S udoku </string> Mstring nameO"continue_label"> Continue</string> Mstring nameO"new_game_label" >New Game</string> Mstring nameO"about_label">Abo ut</string> Mstring nameO"exit_label">Exit</ string>


pac&a'e $(plorer

acka!e or!$e&am le$sudoku= im ort android$a $Activit"= im ort android$os$>undle= ublic class 5udoku e&tends Activit" ? @ Balled when the activit" is first created$ @ AA A C(verride ublic void onBreate7>undle saved;nstance5tate9 ? su er$onBreate7saved;nstance5tate9= setBontent/iew74$la"out$main9= D D


UI Desi'n Screen "ain1!"#

+,(ml version-"1.0" encoding="utf-8"?> +#inear#ayout &mlns3androidE"" android3orientationE"vertical" android3la"outFwidthE"fill_parent" android3la"outFhei!htE"fill_parent" android3back!roundE"@color/background" android3!ravit"E"center" android3 addin!E"30dip"> +Te(t*ie. android3te&tE"@string/main_title" android3la"outFhei!htE"wrap_content" android3la"outFwidthE"wrap_content" android3la"outFmar!in>ottomE" !dip" android3te&t5i,eE" ".!sp" /> +Button android3idE"@#id/continue_button" android3la"outFwidthE"fill_parent" android3la"outFhei!htE"wrap_content" android3te&tE"@string/continue_label" /> +/#inear#ayout0


A2out Screen desi'n


A2out Screen
package org.example.sudoku;

Resource Code

M7 croll8iew xmlnsIandroidO""ttp#//sc"emas$android$com/ impor a! ivi "; apk/res/android" impor a!droid.os.#u!dle; androidIlayoutRwidthO"%ill_parent" androidIlayoutRheightO"%ill_parent" pu$lic class A$ou ex e!ds Ac ivi " % androidIpaddingO"&'dip"> QOverride M$ext8iew pro ec ed void o!C rea e&#u!dle androidIidO"()id/about_content" savedI!s a!ce' a e( % androidIlayoutRwidthO"wrap_content" super.o!C rea e&savedI!s a!ce' a e(; androidIlayoutRheightO"wrap_content" set0ontent8iew32.layout.about ! androidItextO"(string/about_text" /> [ M?7 croll8iewP [ Mstring nameO"about_title">About Android S udoku</string> Mstring nameO"about_text">* Strin' Resource 7 udoku is a logic"based number placement pu##le. 7 tarting with a partially completed SxS grid, the obHective is to fill the grid so that each row, each column, and each of the *x* boxes 3also called MiPblocksM?iP5 contains the digits ; to S exactly once. M?stringP


%enerated )ava Code

pu$lic )i!al class R % pu$lic s a ic )i!al class a!im % pu$lic s a ic )i!al i! cycle_7=0x7f040000; pu$lic s a ic )i!al i! shake=0x7f040001; [


Gmanifest &mlns3androidE"" acka!eE"org.e$ample.sudoku" android3versionBodeE"%" android3versionHameE&".0"> Guses+sdk android3min5dk/ersionE"3" android:target'dk(ersion)"%0" /> Ga lication android3iconE"@drawable/ic_launcher" android3labelE"@string/app_name"> Gactivit" android3nameE".'udoku" android3labelE"@string/app_name"> Gintent+filterI Gaction android3nameE"android.intent.action.*+,-" /> Gcate!or" android3nameE"android.intent.categor../+0-1234" /> G@intent+filterI G@activit"I Gactivit" android3nameE".+bout" android3labelE"@string/about_title" android3themeE"@android:st.le/5heme.6ialog"> G@activit"I Gactivit" android3nameE".7refs" android3labelE"@string/settings_title"> G@activit"I Gactivit" android3nameE".8ame" android3labelE"@string/game_title"/> G@a licationIG@manifestI


Android 8artici

is open to all3 industr"# develo ers and users

atin! in man" of the successful o en source roJects to be as easy to build for as the .e2$



Android is ste in! into the ne&t level of 0obile ;nternet



3@@www$android$com + Android (fficial Keb a!e htt 3@@code$!oo!le$com@android@ + (fficial Android 'oo!le Bode Keb a!e htt 3@@www$o enhandsetalliance$com@ + ( en )andset Alliance Keb a!e htt 3@@www$androidwiki$com L Android Kiki htt 3@@!oo!leblo!$blo!s ot$com@ htt 3@@ ra! ro!$com@book@eband3@hello+ android +5udoku !ame