Get the Cricket widget and many other great free widgets at Widgetbox! Not seeing a widget? (More info) <!-- DMgPqbn97des3UYFj0Ohfw887qs --> The Android Programmer's Heaven

Monday, February 13, 2012

Android Project Compilation,Execution and Installation

So till now we got to know about the Android Project creation. Now next thing i want to keep in front of you is how android projects are compiled and executed.

Android Project Compilation,Debugging and Execution
  So I will give you detailed description about this diagram.
1) First of all every Android project must have one Auto-Generated file This file contains a List of All the attributes we have used in our android Project and a Corresponding Hexadecimal Value. It also contains a Hexadecimal value of main(layout) and app_name(string). We can find this file in Project_Name/gen/package_name/ This file shouldn't be removed otherwise an Android Project will not Work.
2) Secondly, this file along with Application Source Code(.java Files) and Java Interfaces and alternatively .aidl files(Android Interface Definition File) are compiled with JAVA Compiler to create Class Files(Object Code).
3)After compilation step, a .dex file is created that is understandable to Dalvik Virtual Machine only( We won't use JVM here).
4) This compilation step we need not to take care of, We need to Debug this application with Apache ANT (Debug,Release) mode; generally we prefer Debug mode because this mode automatically assign Signed,align key with the Package so that it can be installed directly. If we Use Release mode , We need to manually assign the align key using Zip-align. the Debugging is done inside Root directory where build.xml file is located and command is:
ant debug
5) Now apkbuilder is used to create the corresponding .apk file and alignment and signed key is given using zipalign and now the project is ready to install on a Mobile Device or and Android Emulator.
6) To install this, go to project root directory and bin folder where your .apk file is located  and type on the command line:
adb install project_name-debug.apk

So we are done with the Compiling,debugging and installation phase.

Friday, February 10, 2012

Android Project Creation

Although Android Project Creation is very easy if we use any IDE for it like Eclipse. But Before that we must know about android SDK installation. First of all we need to install a Android SDK package from Google. after the installation of this package, we need to make selection of which version you want to use Eclair, Froyo,Gingerbread,Honeycomb or Ice-Cream Sandwich.
You can easily get the configuration details related with Eclipse easily on the web. But i am going to tell you creation of Project using Command Line

First of all we need to do following configurations in System's Environment Variables:

Go To -> My Computer -> Properties -> Advanced , then Click on Button Environment Variables, then a New Dialog Window Will appear. Now Under the System Variables title look for path. Double Click on it and enter the following things in value. Values are Separated by semicolons. Apache ANT location may Vary but Android SDK should be in the C:\ Drive only.

 1) C:\Program Files\Android\android-sdk\tools
 2) C:\Program Files\Android\android-sdk\platform-tools
 3) D:\apache-ant-1.8.2\bin

Now to create New Android Project Go to command line and type :

android create project
 -n <your_project_name>  
-t <target_ID>   
-p path/to/your/project  
 -k <your_package_namespace>
-a <your_activity_name>
it will automatically create respective directories. the Directory Structure
 of Android will be as Follows:
Suppose Project name is Calculator and root directory of project is Android , then ->


Android Application Architecture

Android Architecture

So The Picture Shown Above Briefly describes the architecture of Android.
1) On the Bottom Level, Linux kernel Provides the necessary Configurations and drivers and overall Management required for running android OS. Like Display driver keeps track of Resolution, Per Pixel Intensity
(PPI). Camera Driver keeps track of Camera Settings like Picture Resolution, Effects etc. Flash Memory Driver takes into account of Flash Memory like ROM(for installation of OS), RAM(for Smooth Multitasking) and SD card(for storage and installation of Applications). IPC(Inter-process Communication) Diver is necessary for communication between the processes for example: you want to play an audio, then Music player process has to communicate with the Audio driver process. Keypad Driver takes care of Virtual Keypad that is used to type the data that you want to send in a Message or E-Mail. Next is WI-Fi(Wireless Fidelity) Driver that keeps track of Wireless Devices in a Particular Range. Audio Divers are responsible for Volume related configurations like volume control, equalizer(Bass,Rock,Pop) etc. Power Management takes into account of Voltages,Temperatures the most efficient settings that makes your Android OS to run effectively.

2) Above this, is a combination of Libraries and Run-time.

Libraries are required for the drivers to work e.g. for Graphics Drivers to Work, we need OpenGL/ES Library
Run-time is used to run a particular android Application under a specific Hardware Environment.

Surface manager manages access to display system and generally takes care of 2D and 3D Graphics Layers.

Media Framework takes care of Image,audio and video media that are supported in a Particular device like MP3, MP4, MPEG3, AAC, AMR, JPEG, GIF etc.

SQLite is a Lightweight yet powerful database Engine.

OpenGL/ES is a Open-Source Graphics Library.

FreeType is a Bitmap and Vector Font Rendering System.

Webkit is a Toolkit that provides tools for browsing the Web.

SSL Secure Socket Layer is a Security system that is used to send Encrypted Information. This is what Android inherited from Linux because it is totally based on Linux Kernel.

libc Its a GNOME C Library Specially made for Embedded Linux devices.

Now the Android Run-time does not use JVM , it has its own Virtual Machine i.e. Dalvik Virtual Machine. for Compiling a Android Project we need ANT which makes a .dex(dalvik executable) file for the Dalvik VM to Run it properly.

3) Application Framework defines how Android Application looks like. it consists of all the Managers that we generally see in a Android Device by-default

Activity Manager Activity is an Android Application Component that provides a Screen with Which user can interact. Activity manager keeps track of all the Activities pertaining to a Specific Process.

Window manager Window is a Graphical Container made up of Pixels. Window Manager take into account of all the Windows,their positioning etc.

Content Providers Content providers manage access to a structured set of data. They encapsulate the data, and provide mechanisms for defining data security. Content providers are the standard interface that connects data in one process with code running in another process. 

View System manages many of the UI elements, including handling user events.

Package Manager manages all the .apk packages and also takes care of whether the package is Signed because it won't allow the installation of Non-Signed Packages.

Telephone Manager  handles making and receiving phone calls.

Location Manager Keeps track of Location of User  based on the GPS(Global Positioning System).

Notification Manager It is a System Service that execute and manage all the Notification you see on your status bar like A New Message Received Alert, Running Applications etc.

4) on the Top , Android Applications that actually runs on an Android Platform. Every Android Device must have some Predefined Applications installed Like Customizable Home Screens, Contacts Management, Phone, Browser etc. After that our Next step will be how to create an android Project.

Thursday, February 2, 2012

Android Development Guide

Hello Friends,
                       Today I want to Share with you all my Experience with the Android Platform. Android Platform is easy to understand but you must have some idea about XML and Swings. Although they are not required, but person having knowledge of these Technologies will be an added advantage in learning the concept.

  Android Development Starts with following things in your mind specifically :

1) The Processing Should be Quick.

2) Start-up shouldn't take too much time.
3) It should have Multitasking Capabilities.
4) CPU Utilization should be less.
5) Graphics Performance should be Good so that you can play even HD games on it.
6) Per Pixel Intensity should be appropriate so that pictures can't get blurred.
5) Less Phone Memory should be Used, it means you must have some capability to move Apps from Phone to SD Card. This can be Done by Rooting the Phone and install one application from Android Market. Although Rooting can JailBreak Your Android Phone ; means you can lost your Manufacturer warranty but still we have solution for it, you can Unroot your Android.