Android Components:Four pillars of every Android app

Before beginning with the actual app development it is very important for every developer to be aware of the four Android Components. These are building blocks of an Application. Any feature that we see in an app is the result of interaction between these components.A developer needs to declare all the components he is using inside the AndroidManifest.xml, this what informs the system of number and names of components used in this app.

The four components are

  • Activity
  • Service
  • Content providers
  • Broadcast Receivers

Continue reading

Android Components : Four pillars of every Android app

Before beginning with the actual app development it is very important for every developer to be aware of the four Android Components. These are building blocks of an Application. Any feature that we see in an app is the result of interaction between these components. A developer needs to declare all the Android components he is using inside the AndroidManifest.xml, this what informs the system of number and names of components used in this app.

The four components are

  • Activity
  • Service
  • Content providers
  • Broadcast Receivers

Continue reading

Android Architecture: How Android Works

 

architecture_android

 

Hello folks! This is my first post in the tutorials category and from the title you might have already guessed we will talking about Android architecture today. Well, to understand any operating system its very important to understand the architecture. I know most of you might not really understand what exactly does a “operating system architecture” mean. So let me simplify the term. Architecture is basically a design, design flow of how the machine works in order to perform any operation. What you see on screen is just the upper layer of this architecture. Any action you perform on this layer goes through some set of layers and in the end interacts with the hardware of the machine commanding it perform the action(requested by you).

 

Continue reading

Android Architecture : Learn How Android Works

 

architecture_android

 

Well, to understand any operating system its very important to understand its architecture. I know most of you might not really understand what exactly does a “operating system architecture” mean. Architecture is basically a design, design flow of how the machine works in order to perform any operation. What you see on screen is just the upper layer of this architecture. Any action you perform on this layer(screen) goes through some set of layers and in the end interacts with the hardware of the machine commanding it perform the action(requested by you).  Android was created for small machines. So designers had to keep in mind that they would be working with limited resources yet will have to replicate the operations performed on big machines. Therefore they had to come up with a architecture specific to small devices.

Android Architecture can be classified into four layers

  • Linux Kernel
  • Libraries+Android Runtime
  • Application Framework
  • Applications

Before diving deep on its working you might want to know how Android started and who invented it. Read How Android Started to know more

Linux Kernel

This is the at the bottom of the Android architecture. Let us first understand what exactly Kernel means. Kernel is central module of a OS. It is responsible for memory management, process management and disk management. Basically  kernel is the first layer of software that interacts with the device hardware.

So even Android needs a kernel and instead of writing its own they choose Linux. Why? Because Linux is open source, Google’s Android developers could modify the Linux kernel to fit their needs. Linux gives the Android developers a pre-built, already maintained operating system kernel to start with. This is the way many different devices are built — for example, the PlayStation 4 uses the open-source FreeBSD kernel, while the Xbox One uses the Windows NT kernel found in modern versions of Windows.

HAL(Hardware Abstraction Layer)

Android application/framework communicates with the underlying hardware through Java APIs not by system calls. But the Linux has the ability to handle only systems calls from application. Therefore a layer is required which acts as bridge between software and hardware. HAL acts as this layer. The hardware abstraction layer, or HAL as its popularly known  defines a standard interface for hardware vendors to implement and allows Android Applications to be agnostic about lower-level driver implementations. It is a c/c++ layer which is a vendor specific implementation. HAL implementations are packaged into modules (.so) file and loaded by the Android system at the appropriate time. Android HAL allows the Android application/framework to communicate with the hardware specific device drivers.

Libraries

On the top of HAL we have a set of libraries These libraries are used to enable various features in the Android OS. All these are written in C++. I am listing some of these libraries with its function.

SQLite It is used to access data published by content providers and includes SQLite database management classes
SSL It is used to provide internet security
OpenGL It is used to provide Java interface to the OpenGL/ES 3D graphics rendering API.
Media framework It is used to provides different media codecs which allow the recording and playback of different media formats WebKit It is the browser engine used to display internet content or HTML content

Within this layer comes the most important part of Android Architecture – Android Runtime

Android Runtime basically has two components

  • Dalvik Virtual Machine
  • Core Libraries

 

Dalvik Virtual Machine

Well I consider this as the most important part of Android architecture. This is what makes Android ->”ANDROID”:P Actually everything above this level of the Android architecture  is written in Java. So basically we will have a set of .class files. Running those .class files on a small mobile processor is could lead to issues. Dalvik Virtual machine converts these .class files into .dex files which makes processing much faster. These files run with minimum memory footprint. Hence you can have multiple instances of this Virtual Machine running  i.e. Multitasking. Dalvik Virtual Machine is similar to JVM but only difference is that it is designed and optimized for Android.

Core Libraries

These are a set of libraries written in Java to provide APIs for Android development

 

Android Application Framework

This is the topmost level of Android Architecture. It is basically the environment in which your application runs. This layer provides high level APIs for your android application, enabling it to implement custom features. I have listed some components below

  • Activity Manager – Controls all aspects of the application life cycle and activity stack.
  • Content Providers – Allows applications to publish and share data with other applications.
  • Resource Manager – Provides access to non-code embedded resources such as strings, color settings and user interface layouts.
  • Notifications Manager – Allows applications to display alerts and notifications to the user.
  • View System – An extensible set of views used to create application user interfaces.
  • Package Manager – The system by which applications are able to find out information about other applications currently installed on the device.
  • Telephony Manager – Provides information to the application about the telephony services available on the device such as status and subscriber information.
  • Location Manager – Provides access to the location services allowing an application to receive updates about location changes.

 

Applications

This contains all the application that you see on your device. This includes system based apps like Contacts, Calender etc and all the applications you have installed from the Google playstore. All these are developed with the help of APIs from core libraries and Android framework

 

Now that you have understood the Android architcture click here to read about the four important components of Android.