This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.
The android architecture is very efficient and highly advanced operating system. Google always defines the android architecture as a software stack which has different layers of programming which all together support to form the android architecture. The architecture structure is shown bellow and this structure represents the stack form of android architecture where each layer represents its own functionality that make the operating system to work. We start the architecture from its bottom layer and come up step by step.
The base layer is the Linux kernel where the operating system is related to the hardware parts that are available in the mobile phone each driver controls each hardware component in the phone for example consider a mobile phone which has a camera so if we want to use a camera in a mobile phone the camera drivers should be activated so that we can access camera. Similarly all the divers that are available works accordingly to their respective hardware parts those are available in a phone.
The next stack is the Libraries that are developed using the C/C++ which are used by various components in android system. The libraries capabilities are exposed to the users or the developers by using android application framework, the prominent core libraries include in this libraries stack are as follows.
System C libraries that are used by standard C libraries which are tuned for standard Linux based driver devices.
Media libraries that are based on packet video's open core, these libraries support large amount of playback and recordings of video and audio format and even static image files which include MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.
Surface manger libraries are those libraries that manage access and display subsystems and compositions of 2D and 3D graphical display layers from different applications that are developed.
LIbWebCore is a modern web browser which is used to power both the android browser and an embeddable web viewing system.
SGL is an underlying web viewing 2D graphic engine.
3D libraries are the implementation based on open GLES 1.0 API's these libraries uses the hardware 3D acceleration which is a highly optimized 3D software rasterizer.
Free type bitmap and a vector font rendering.
SQLite libraries which is a powerful and lightweight relational database engine available for all the applications which are developed in android.
Android System Architecture
Fig 1:-The Android Architecture Diagram.
There is an array of managers that providing services for the functions that are performed inside a mobile phone such as Activities and views, Telephony, windows, resources, location based services. These are the few of the functions that are required for a developer for developing an application in android.
The next stack layer which is adjacent to the libraries stacks which is named as Android runtime stack. This stack contains two different labels which are core libraries and Dalvik virtual machines
The core libraries consist of core java packages which are full featured java programming environment.
The Dalvik virtual machine provides services for Linux kernel which are used to provide an environment for Android applications that are developed. All the core applications which come with the Android OS and the third party applications run in Dalvik virtual Machine.
The next stack is an application framework part which consists of different managers in it. Each manager has its own resources working depending on the functions called in the applications code which we have developed in android.
The final stack is where we seen the applications that are inbuilt and also the applications which we have developed.
We may have doubts that why android OS is developed using Linux kernel? , this is because a full featured platform like Linux kernel which provide tremendous power and capabilities that led the android to develop in feature and the main advantage is that since the OS is open source it unleashes the capabilities of talented individuals and companies around the world, this will lead to rapid changes in mobile technology and will also advance the development of the platform. The most important things that we should is about the Dalvik virtual machine which is needed for efficiency on rich programming environment and with some intellectual properties constrains that collide with innovations in developments so android provides a rich application development programming language JAVA, JAVA is very accessible because of its popularity and applications performing at very low memory states particularly like mobile phones, so android applications are developed in java programming language.
2.2 Booting Android Application Basics:-
Android applications are mostly developed is JAVA, and XML and we can develop a application by using any one of these tools called Eclipse Galileo (or) Eclipse Ganymede these two tools are official recommended by Google for developing applications in android, to start an developing an application in android first we need a working knowledge on Eclipse usage and how to execute the program or a code that we have developed, but there are few more Basic structures that we need to learn before we go into the coding. When a developer start writing a code for an application in android the following fundamental should be remembered, these fundamentals may be confusing but as the developer continues to develop the code then he/ she will consistently get use to these fundamentals.
Every application is Unique in its own world; every application follows its own path that a developer has created. Such as
Every application runs on its own Linux process in Android OS, Android starts the application code execution only when there is a need of application by user or else it will shuts down the process when it is no longer needed or it will also shut down temporally if the system resources are required by any other applications.
Every application starts with its own virtual machine so that the application code can run Isolated from other applications.
Every application will be assigned with its unique Linux user ID, which is done in default by the Android OS. Permissions are set only to use for the user and for the applications only. Of course there are ways to use these permissions by other applications also. It is also possible to run two different applications in single Virtual machine and we can also make those applications to use same Linux ID.
2.2.1 Android Application Components:-
Android application components are very important for a developer these component are used in every point and place of developing the application, the main feature of Android application Development is that a developer can use other application elements. For example consider a scroll of contacts that are to be implemented in your application then you can make use of these android components to display the contacts in your application or you can also make use of other information from different application, this approach will reduce the code work for a developer and save time. So these components are used by any developer for developing any kind of application in android. There are four types of components that are used in application development; each component is explained as follows.
Any application in Android should start with activities, a activity is a visual user interface that interact with the user, but an activity need not be visible UI all the time it can also be running in background without an UI, most of the applications will have activities running with UI.
Example: - consider an application in which we are collecting all the contact information in the phone so to make this collection of contacts and show it on mobile screen so the application will run an activity which collects the contact information, in similar way to send a message to all the contacts an activity will be executed in the application. So from this example we can understand that every activity is independent from every other activity, and all activities in an application are interconnected with each other, depending on their functionalities.
Services are very important component in any kind of mobile operating system, a services component is a functionality that will be running in background of an application, it doesn't have any user interface, it will be running in the background of an application.
Example: - Imagine a user who wants to listen to music in his mobile phone and he expects to continue the music ever after he made a call or received a call in his mobile phone so before getting a call he will be listening to music and as he hears the ringtone the music disconnects and this music process will continue only after he finishes his call, so from this we can understand the service component is very helpful in any kind of mobile OS. This service component is not only restricted to music players, this can be applicable in many ways like any ongoing process, if a application want an access to some other information from internet it need not show the background process, similarly if the user wants to access the internet while listening to music , services are very helpful in these cases. Most of the smart phones will use services in their code work for better accessibility to the customer.
Broadcast receiver is a component which receiver and reacts to the broadcast announcements in android, broadcast receiver has most of its functionality inside the system code but we can use these broadcast receivers for our application developments also. Applications can have any number of broadcast receivers and broadcast receiver doesn't have any user interface appearance but it can activate the notification manager to alert the user by vibrating, flashing light small sound or a notification on the screen. Broadcast receivers are very important in android coding. Most of the developers will and must use broadcast receiver for any type of developments in a application.
A content provider component will provide a very certain and important information to other applications based on the requirements of the developer, and the data can be stored in a form of a file in basic SQLite database service that is available in mobile phone. The data can also be stored in any other forms, like a word format which can be stored in the micro SD card inside the phone. A content provider is a standard set of class that are available using methods which are called inside the code where the methods that can retrieve data from other applications and can be used depending on the user requirements. A content provider can't be used directly we need to use another object called content resolver which is used to call content provider methods.
2.2.2 Activating Components:-
All the above components can be activated only when there is a request from respective targets, Content providers are activated by Content resolvers, but services, Activities, and Broadcast receivers are activated only by using INTENTS, Which is a very important and most active coding process in android code work.
Intent is an asynchronous message which is called as intent object in java terms, which holds the abstract description of a operation that to be performed. Intent shows the action to be done or specified to activities and service components, for a broadcast receiver intent is used for the names of an action being announced.
Example: - Intent can be used to announce that music button or camera button has been pressed to the interested objects inside code.
There are separated methods to activate each component in the code these are as follows.
Any activity is launched by passing an Intent object to context.start.activity () or Activity.startActivityforResult (), the response from these objects is called by initial intent that is caused to be launched by calling getintent () method. Android calls the activity OnNewIntents () methods to pass it any subsequent intents.
A service is started or new instructions are given to an ongoing service by passing an Intent object Context.Startservice (). Android calls the service'sÂ on start () method and passes it the Intent object.
An application can initiate a broadcast by passing an Intent object to methods likeÂ Context.sendBroadcast(),Â Context.sendOrderedBroadcast(),and Context.SendStickyBroadcast() in any of their variations. Android delivers the intent to all interested broadcast receivers by calling theirÂ onRecive ()Â methods.
Intent phone=New Intent (Intent.ACTION_DIAL, uri.prase ("tel: 7878756534));
Start Activity (phone);
Intent are declared in very simple way when we get through very huge number of coding lines then it will be little bit difficult to identify the difference between the intents so we need to be careful in writing the intents and calling them.
In the above box we can see the syntax of how we declare the Intent in android. The word (phone) is the name of the intent we have declared and the functionality that we have give to this intent is to dial the number 7878756534, and at the end this is an activity we need to ask it to start the activity so we call the activity to start with name of phone. So this is how we declare intents in android. For more information on intents we can visit to http://developer.android.com/reference/android/content/Intent.html .
An intent filter is a declaration of capacity and interest in offering assistance to those in need, intent filters can be generic or specific with respect to intents it offers it access. Every component has its intent filter declared so a components intent filter declares that what kinds of intent filter that it is able to handle. Intent filters are declared in the Manifest .XML file which is very important file in android code work.
<action android:name="android.intent.action.MAIN" />
The above syntax shows the Intent filter declaration in manifest.xml file. This intent filter declares two processes one is the action and other is the category. The android name declares the respective action and category that is to be processed.
Shutting down components:
The components can be shutdown or stopped working based on application requirements the content provider will be responding only until the content resolver request is completed, and the broadcast receiver will be active until the broadcast message is responsive and these two components need not be closed explicitly. The Activity component can be shut down by calling the Finish () method and one Activity can shut down another Activity by passing finish Activity () method. A Service component can be stopped by calling itself which is StopSelf () method or Context.StopService () method.
2.2.4 Manifest.XML file:
Manifest file is very important in android, to run any application in android the manifest file is used this manifest file is already present in android file whenever a new project is created in Eclipse. When an application is started in android the OS should know what are the components that the particular application is using so all the components that a application use are declared in the manifest.XML file. The manifest file has XML syntax and all the components are declared in the form of XML structuring. The manifest file has many other functions other than component declaration such as we can declare Libraries that an application needs beside Android libraries, and accepting permissions that an application expected to be granted. We see the syntax of a manifest.XML file.
<? xml version="1.0" encoding="utf-8"?>
<manifest . . . >
Â Â <application . . . >
Â Â Â Â <activity android:name=".battery"
Â Â Â Â Â Â Â Â Â android:icon="@drawable/small_pic.png"
Â Â Â Â Â Â Â Â Â android:label="@string/phone"
Â Â Â Â Â Â Â Â Â . . . Â >
Â Â Â Â </activity>
Â Â Â Â . . .
Â Â </application>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
The syntax for Manifest.XML file is shown above and we can observe an activity is defined with a name (.battery), and this activity is placed in an application tags which defines the activities inside the application, any activity in a application should be defined inside this application tags. In a similar way we develop the application manifest file depending on the application activities that are used. We also declare the android permissions that are required to access some of the parts of the mobile phone hardware and these are show in syntax with uses-permission tag. The permissions which are declared are first read by Android OS and these permission accesses are granted by OS which will help the application will run further.
2.3 Mapping application: - Every android application will run with single Linux process Android relies on Linux operation for proper process management, every application which runs in android runs in an instance of Dalvik Virtual machine. The OS sometimes need to unload or kill the application based on to allocate the resource demands. There is a hierarchy or sequence that every android OS system follows which is used to store the resource victim. In general there are few rules that OS follows.
Visibly running activities have top priority.
Visibly non running activities are important because they are recently paused and are likely to be resumed shortly.
Running service has next priority.
The most likely candidates for termination are processes that empty or the processes that have the dormant Activities.