Wednesday, 25 January 2012

How to setup ADT plugin for Eclipse

In the previous article Introduction to android you have seen basics of android and its architecture. In this article  let use see how to setup ADT(Android Development Tool) in eclipse.

1.Download SDK

First you need to download android SDK from here. The SDK includes only the core SDK Tools, which you can use to download the rest of the SDK components.

If you downloaded a .zip or .tgz package (instead of the SDK installer), unpack it to a safe location on your machine. By default, the SDK files are unpacked into a directory named android-sdk-<machine-platform>.

If you downloaded the Windows installer (.exe file), run it now and it will check whether the proper Java SE Development Kit (JDK) is installed (installing it, if necessary), then install the SDK Tools into a default location (which you can modify).

Make a note of the name and location of the SDK directory on your system—you will need to refer to the SDK directory later, when setting up the ADT plugin and when using the SDK tools from the command line.

2.Installing the ADT Plugin for Eclipse

Follow these steps to download the ADT plugin and install it in your Eclipse environment.


1.Start Eclipse, then select Help > Install New Software....

2.Click Add, in the top-right corner.

3.In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location:

4.Click OK
Note: If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).

5.In the Available Software dialog, select the checkbox next to Developer Tools and click Next.


6.In the next window, you'll see a list of the tools to be downloaded. Click Next.


7.Read and accept the license agreements, then click Finish.
Note: If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.

8.When the installation completes, restart Eclipse.


3.Configuring the ADT Plugin

After you've successfully downloaded the ADT as described above, the next step is to modify your ADT preferences in Eclipse to point to the Android SDK directory:


1.Select Window > Preferences... to open the Preferences panel (Mac OS X: Eclipse > Preferences).

2.Select Android from the left panel.

You may see a dialog asking whether you want to send usage statistics to Google. If so, make your choice and click Proceed. You cannot continue with this procedure until you click Proceed.

3.For the SDK Location in the main panel, click Browse... and locate your downloaded SDK directory.

4.Click Apply, then OK.
That's it!

4. Adding Platforms and Other Components

The last step in setting up your SDK is using the Android SDK and AVD Manager (a tool included in the SDK starter package) to download essential SDK components into your development environment.

The SDK uses a modular structure that separates the major parts of the SDK—Android platform versions, add-ons, tools, samples, and documentation—into a set of separately installable components.

The SDK starter package, which you've already downloaded, includes only a single component: the latest version of the SDK Tools. To develop an Android application, you also need to download at least one Android platform and the associated platform tools. You can add other components and platforms as well, which is highly recommended.

If you used the Windows installer, when you complete the installation wizard, it will launch the Android SDK and AVD Manager with a default set of platforms and other components selected for you to install. Simply click Install to accept the recommended set of components and install them.

You can launch the Android SDK and AVD Manager in one of the following ways:
  • From within Eclipse, select Window > Android SDK and AVD Manager.

  • On Windows, double-click the SDK Manager.exe file at the root of the Android SDK directory.

  • On Mac or Linux, open a terminal and navigate to the tools/ directory in the Android SDK, then execute:
    android
 
To download components, use the graphical UI of the Android SDK and AVD Manager to browse the SDK repository and select new or updated components

Wednesday, 18 January 2012

Introduction to Android

What is android?

Android is an operating system for mobile phones, tablets developed under Open Handset Alliance(OHA). It includes OS, Middleware and Applications. The first android mobile phone was Google's G1 released in 2008 in collaboration with T-mobile.

What is Open Handset Alliance(OHA)?

OHA is a group of organizations collaborating to build a better mobile phone. The group is led by Google, includes mobile operators, handset manufacturers, platform providers, and marketing companies. Android is the first complete, open, and free mobile platform developed by OHA.

Some Big players of OHA
  • Mobile operators :-  Sprint, T-Mobile, vodafone, NTT docomo, etc
  • Handset Manufacturers :- Acer, Alcatel, Dell, Fujitsu, HTC, Huawei Technologies, LG Electronics, Motorola Inc, Samsung, Sony Ericsson, etc
  • Semiconductor Companies :- ARM, Intel Corporation, Marvell Semiconductor Inc, MIPS Technologies, NVIDIA Corporation, Qualcomm Inc, ST-Ericsson,Texas Instruments Incorporated, Via Telecom, etc
  • Software Companies  :-  Google Inc, eBay Inc, Myriad, MOTOYA Co, SkyPop, SONiVOX, VisualOn Inc, ACCESS CO LTD, etc


Architecture of android OS




There are 4 layers in android
  1. Linux kernel
  2. Libraries
  3. Aplications framework
  4. Applications

  • Linux Kernel
This is the lowest level. Linux version 2.6 is used to build the android's kernel. This kernel includes Memory management programs, Power management progrmas and other hardware drivers such as Bluetooth Driver, Camera Driver, Display Driver, USB Driver, Audio Driver. The Drivers are the programs that control hardware of a device for example the bluetooth driver manages bluetooth application and using Camera driver you can send commands to the camera hardware.

  • Libraries
The next level is libraries.  Libraries are the set of APIs through which you can access and handle different kinds of data. The libraries included are SQLite, Webkit, Media Framework, OpenGL/ES,etc. If you want to play a media player then you need to use Media Framework library, If you want to store data in a database then you need SQlite.

 In the same layer you will find two more elements a.Dalvik Vertual Machine b.Core libraries

a.Dalvik Vertual Machine :- This is where all android application run. It is like JVM in Java

b.Core libraries :- These are the set of core libraries that provides most of the functionality available in the core libraries of the Java programming language
  • Application Framework
The next highest level in the architecture is application framework. This layer consists of several programs manage the basic functions such as handling a telephone application which is managed by Teliphony Manager, Knowing physical location of a phone which is handled by the Location Manager, sharing data across applications which is handled by Content Providers, A Notification Manager that enables all applications to display custom alerts in the status bar, An Activity Manager that manages the lifecycle of applications.
  • Applications
The highest level in the android architecture is Applications. This is the layer for common users where they can open a web browser, make a call, play a game etc.

Why android?

There are many reasons why you should consider using android phones or why you should develop applications for android devices.

For Users

1. Hardware flexibility :- Some users prefer large screen mobiles and some users prefer mobiles with small screen because they feel that it is easy to carry. Some users want phone with high resolution camera where as some users dont care for camera resolution. Some Users want really large storage space. If you consider iphone only third requirement can be met where you can buy iphone with 8GB,16GB and 32GB of storage space but in android all the requirements can be met as there are many vendors who manufactures devices with varying size, storage space etc.

2. Faster pace :- As you are aware there are tens of hundreds of new android mobiles released daily where as apple releases new models at much slower pace compared to its competitors.

3.Price :- This is the main reason why users should look at android. Iphone comes with only one price but in android there many devices with diffrent price options.

For Developers


1.Language :- If you want to develop for iphone you should learn Objective C where as in android you can develop apps using java which is more familiar to many developers.

2.OS :- If you want to develop for iphone you should buy Mac OS.You cant develop iphone apps on Windows or linux where as to develop android apps you can use any OS.

3.Developer account :- You need to pay 99$ per year to open iphone developer account where as in android it's 25$ for lifetime.

In the next article I will show you how to write a Hello World application in android.