Showing posts with label introduction. Show all posts
Showing posts with label introduction. Show all posts

Thursday, April 15, 2010

The intricacies of Application in Android

The Application is the top layer in the Android Framework. This is the code which we write. As you know, all the application coded in Android are in Java. The Dalvic Virtual Machine in the Andorid Runtime layer is responsible for running this compiled bytecode. This bytecode is packaged into a .apk file which is also called Android Package using the Android Asset Packaging Tool(or aapt in short). This .apk file needs to installed on phones that support the version its packaged for. 

There are certain properties of each android application which is important to know of. 
1. Each process runs as a linux process in Android. Android has the ability to shutdown the process when there is a need to acquire more system resources. So you need to be careful about this while coding your app on Android.
2. Each process runs over its own Dalvik Virtual Machine. So  there is proper isolation of code and data. To conserve system resources we can start two different application(with same Application ID) in the same virtual machine by running them as a single linux process.
3. Each application is assigned its own Linux UserID, so the files from one application is unique to that.You can make two application to have the same Linux UserID, in that case they can share the files.

Architecturally, Android applications can be viewed as made up of four different component:
1. Activity - All UI are termed as an activity
2. Service - Anything that is not UI and does not work in the background is called as service
3. Broadcast Receiver  - It receives various updates and responds to them, eg, low battery, language changed etc.
4. Content Provider - This is the component built to provide data to other applications.

In the next few post I will be digging deep in the different components and how and when to use them.

Wednesday, April 14, 2010

The Architecture of Android

The architecture of Android consists of the following layers
1. Applications
2. Application Frameworks
3. Libraries
4. Android Runtime
5. Linux Kernel


As made clear from the above diagram, the Applications such as the ones we use on the phone like search application, SMS and email clients, maps etc. form this layer.
These applications make use of core services which are provided by the Application Framework. With things like Location Manager, Notification Manager, various Content Providers etc., the application can depend on them to provide the service.
If we are coding in Java, with eclipse, we make use of Android Runtime which consists of the Dalvik Virtual Machine and the core libraries. This is the part which is responsible for running our applications in transparent way, independent of the machine architecture below.
This layer also acts as a wrapper around the different libraries which include libc, SQLite, Webkit(the browser), 2D and 3D graphics library, Encoder and decoders for various formats. You can make use of the NDK(Native Development Kit) to use these libraries directly.
The bottom of all this is the stable and reliable Linux Kernel. With all driver, memory and power management being handled by this layer.

Whats exactly in each of these layers, I will learn and write about them in the forthcoming posts.