In this article we are going to explore android platform. Android is becoming more and more popular these day and a study indicates that there will be more than 500 billion apps downloaded till 2015. So if someone want a career in IT sector then they should know Mobile App Development. So in this series of articles we will look into android platform and in later tutorials will create some practical apps using android platform.
What is android platform?
According to a definition,
“Android is a software stack from Google, that includes an operating system, a middleware and also key apps for use on mobile devices, such as smart phones and tablets.”
This software stack includes low level operating system services that manage the device to the sample applications Like phone dialer, database of contacts or web browser etc.
Android also included a SDK or software development kit to create android applications. There are huge number of learning resources available for android including blogs, documentation and tutorials on internet.
The image below shows overall architecture for Android.
Firstly there is Linux Kernel Layer, above that there is Libraries layer with Android Runtime. Android runtime includes core libraries and dalvik virtual machine. Above that there is Application Framework layer that support the development of new applications and at the top android provides applications, such as phone dialer, contacts and browser.
Let us explore these layers individually.
1. Linux Kernel Layer
In android platform Linux Kernel Layer the the lowest software platform layer. All the core services that an android device rely on are provided by this layer. Android Linux kernel provides generic operating system services like it provides the
1. Permissions Architecture to restrict access to data and resources to only those processes those have proper authorizations.
2. Memory and Process Management so multiple processes can run simultaneously without interfering each other.
3. Handling of Files and low level network I/O.
4. Allows the Device Drivers to be plugged in so that android can communicate with low level hardware components.
Android Linux kernel include android specific components such as it own Power Management Services because mobile devices often run on battery power.
It provides memory management and memory sharing features because mobile devices have limited memory.
Android Linux kernel also includes it own Inter process Communication Mechanism called Binder, that allows multiple processes to share data and services in a sophisticated ways.
These are some of android specific features there are many others as well.
2. Libraries Layer
Next layer includes system libraries, these libraries are normally written in C and C++ for that reason they are often referred as Native Libraries.
These native libraries handles a lot of core performance sensitive activities on an android device like quickly rendering web pages and updating the display. Android has its own system c library which implements standard OS system calls which performs actions like process and thread creation, mathematical computations, memory allocations and much more.
Other libraries are Surface Manager which handles display, Media Framework for playing back audio and video files. Web Kit for rendering and displaying web pages, Open GL for high performance graphics and SQL Lite for managing in memory relational databases.
In addition to the system libraries this layer also includes the Android Run Time, which supports writing and running android applications. There are two main components in Android Run Time. They are
1. Core Java Libraries
2. Dalvik Virtual Machine
Let us discuss these libraries in further detail.
1. Core Java Libraries
Android application are written in java programming language and to make it easier to write apps android provides number of reusable java building blocks, for example
Basic java classes liek java.* , javax.*
Android packages have softwares that are specific to life cycle of android applications
Internet / Web Services using ORG.* packages.
Junit packages that supports unit testing.
2. Dalvik Virtual Machine
Dalvik Virtual Machine is the software that executes android applications and a typical workflow of an android application is like
developer writes code in java programming language and then java compiler converts these source code files to multiple java byte code files.
Next a tool called DX converts java byte code files to a single DEX Byte Code File and is usually known as classes.dex.
Next the dex file is packaged with other application resources and is installed on a device and finally when user launches the android application dalvik virtual machine will then execute classes.dex file. The reason behind the fact that Dalvik Virtual machine is designed other than Java Virtual Machine is that it is designed for Resource Constrained Environments which is typical for mobile devices.
Resource Constrained Environment means that a mobile device as compared to desktop device, mobile device is less powerful and more limited in many ways for example it will have a slower CPU, less RAM (memory) and a limited battery life.
3. Application Framework Layer
The application framework contains reusable softwares that many mobile applications are likely to need, for example the view system contains common graphical elements like buttons, icons that many applications include in their user interfaces. Let us explain some of the components.
1. Package Manager
Package manager is essentially a database that keeps track of all the applications currently installed on your device.
2. Window Manager.
Window manager manages many windows that comprise applications.
3. View System.
View system provides many common user interface elements such as icons, buttons, text boxes and lot more.
4. Resource Manager
This component manages non-compiled application resources like strings, graphics and layout files
5. Activity Manager
Activity manager manages the Life Cycle and Navigation Stack. (An activity is a single user application screen in android).
6. Content Provider
Content Providers are databases that allow applications to store and share structures information like phone application can access stored contact information and use to dial a phone number as contact information is stored in a content provider. Content providers are designed to work across applications like not only phone dialer can access contact information but messaging application or social media application can also access this information.
7. Location Manager
Location manager provides the location and movement information, for this it can make use of information generated by GPS.
8. Notification Manager
Notification manager places notification icons in the status bar when an important event occurs.
4. Applications Layer
The last layer in android application framework is application layer.
Android platform comes with some built-in applications, these included things like
- Home Screen – Main Screen
- Contacts – Contacts Database
- Phone – Dial Phone Numbers
- Browser – View Web Pages
- Email Reader – Compose and Read Email Messages
This article gives a brief introduction to android platform. In coming articles we will dive deeps into android app development.