Monday, November 23, 2009  
Google
Web pcquest.com

CIOL Network sites

Search by Issue | Sitemap | Advanced Search

• For most updated version of DQ TOP 20 issue, visit dqindia.com • Ad : Play and Plug ERP by IBM
 Home > Developer

Android: Its Anatomy and Features

Will Google's Android create a storm in the mobile operating system arena? We take a look at what features and technology it's packed with, and also build an Intent-based app

Saturday, March 01, 2008

Print Comment Email DiggDigg DeliciousDel.icio.us RedittReddit TwitterTwitter

Google's Android operating system for mobile phones has already created a buzz in the market even before any manufacturer started shipping mobile phones based on Android. Though key players of mobile operating systems like Symbian, Microsoft, and Apple are already established in this field, Google has tried to make its presence felt by giving many firsts with Android to the developers. The main reason for the buzz being it's the first truly open source comprehensive platform for mobile phones. The Android includes an operating system, user interface, and applications developed using the Android SDK. In all, the Android is a complete set of software that is needed to run a mobile phone without having any proprietary impediment from the manufacturer, which till yet used to hinder mobile innovations.

Android will provide an open mobile software platform that will enable creation of applications that would run and give same user experience on any Android-based phone. This hasn't been the case till now because developers had to refer to the manufacturers' phones specifications before developing the mobile applications for it. So with Android, if the developer has an idea of a killer app for mobiles he won't have to go into mobile phone's specifications but rather develop the app and have it deployed on any Android-based handset irrespective of its manufacturer. In the last month's issue we had talked about the Open Handset Alliance (OHA) and also had shown how to get started with the Android application development. Now, let's see what's inside Android and what tools and APIs do Android provide for innovative app development, and later we will take the Android app development to next step.

Direct Hit!

Applies To: Java developers
USP: Platform for developing rich mobile apps
Primary Link: http://code.google.com/android/download.html
Keywords:
Google Android
On CD: NA

Anatomy of Android
The Android operating system includes four major components: the kernel, core libraries, runtime, and application framework. The Android SDK includes a Linux 2.6 kernel as the operating system for the mobile phone that provides the core system services such as memory management, process management, security, networking, drivers, etc. This kernel also provides the base for abstraction layer between the hardware and the rest of the software stack. On top of this hardware abstraction layer rests a set of native C/C++ libraries for features such as media codecs, SQLite database, and WebKit. The WebKit is an open source Web browser upon which the Android's integrated Web-browser is based. The next layer in the Android software stack is of the Android's runtime. Google has specifically chosen Dalvik Java virtual machine (VM) for Android as it is fine-tuned for mobile devices in terms of limited battery and CPU conditions. The Dalvik Java VM has a compressed bytecode format and can simultaneously run multiple applications with lower resource consumption like memory. Therefore each Android application runs in its own process, with its own instance of Dalvik VM and is in Dalvik executable (.dex) format. This results in lesser memory consumption as .dex format files have minimal memory footprint. For functionalities like threading and low-level memory management Dalvik VM relies on the underlying Linux kernel.

Android's architecture consists of different components with the top-level apps being able to access the Application Framework's core functional libraries or APIs

The application framework layer provides developers with access to APIs that are being used by the core applications. This allows developers to build applications that can access phone functionalities like making calls, accessing calendar, or even using the camera of the phone. The Android SDK uses Java for the application development, but it does not incorporate the complete JDK. This has resulted in Android having core Java packages like java.nio, java.lang, and java.util. But the traditional Java user interface packages like Swing and AWT are absent. This user interface support has now been switched with custom 2D graphics library and 3D graphics library, based on OpenGL. These new graphics library provide better graphics experience to the users and can also easily be used and learned by developers.

Though, Android will ship with Java-based core applications including email client, SMS program, calendar, maps, and contacts among others, it would provide an opportunity for developers to build upon these applications and customize them to make new innovative apps.

Maps and Location APIs
With Android SDK, Google provides two APIs: Location and Maps. As Google has the required knowhow of the server infrastructure to provide location-based service through Google Earth and Google Maps, it seems an intelligent move from Google to provide two useful packages: com.google.android.maps and android.location, along with Android SDK. The android.location package contains several classes related to location services in the Android platform. This package introduces the LocationManager component of the core application framework which provides an API to determine location information if the underlying device provides the support. While the com.google.android.maps package incorporates classes related to rendering, overlaying, and controlling the information on Google Maps.

Thus with LocationManager, a developer can write an application that would alert the user when he comes near a certain location and using the Maps APIs the user can also be shown the route to that location using Google Maps.

A custom made application showing through Location APIs how to locate friends in the vicinity

Though these APIs for extracting location information based on the nearby cellular network towers isn't new, it was already present with Jaiku. Running Jaiku on Symbian S60 platform mobile phones, one could get the location of the device through the GPS data. Now as Google has bought the Jaiku, it can provide location specific advertising to the users. Also apps can be build by developers to provide location-based information, like an application that may tell you how far you are from another friend and also an intuitive map can be displayed to user on his Android-based phone showing the road route to his friend's location.

Android application
In the last issue we have seen how to install and start a new project to build Android apps using Eclipse. An application built on Android will be consisting of four building blocks-Activity, Intent, Intent receiver, and Content Provider.

Activity: Activity is the most common of the four building blocks of Android application. An activity is screen of the application and each activity is implemented as a single class and it extends the Activity base class. Each of these activity classes represents the user interface composed of views and interacts with him and responds to events.

Intent: Intent describes what an application wants to be done. Intents are special classes that Android uses to move from one screen to another. IntentFilter is a related class for Intents, while an Intent is effectively a request for a task to be done, IntentFilters are description of what Intents an activity can handle.

With the built-in Maps app one can view Google Maps through the emulator. Through Location and Maps APIs, developers can overlay maps to customize them

IntentReceiver: IntentReceiver is used in application code to execute actions based on certain external events or requests. For example, IntentReceiver can be used to execute an activity when the phone rings. For an IntentReceiver to be called it's not important that the application has to run; the system will start the app whenever the IntentReceiver is triggered.

ContentProvider: ContentProvider is a class that implements set of methods to allow other applications to store and receive the type of data that is handled by the content providers like SQLite database store, etc.

Now we have developed an application where Activity was involved, let's move ahead and create an application that's based on Intent.

Favorite Page App
We will make an application that will list user's favorite Web pages and when user clicks on one from the list, the browser is triggered and the website corresponding to that is opened, as the page listing the favorite links would be the Activity that will send Intent to the system to open a Web-browser.

Start a new Android project in Eclipse and name it as BookmarkList. On new android project window screen, give the properties values as:

  • Package Name: com.pcq.android
  • Activity Name: BookmarkList
  • App Name: Favorites Page List
     

Page(s)   1  2  

Print Comment Email DiggDigg DeliciousDel.icio.us RedittReddit TwitterTwitter


Untitled Document



ZTE:Leading CDMA Technology



   
 

 
 

Magazine Subscription | RQS | Contact Us | Team PCQuest | Advertising - Print | jobs@cybermedia