Friday, 14 November 2014

AndroidManifest.xml file in android

The AndroidManifest.xml file contains information about your package, including components of the application such as activities, services, broadcast receivers, content providers etc.
It performs some other tasks also:
  • It is responsible to protect the application to access any protected parts by providing the permissions.
  • It also declares the android api that the application is going to use.
  • It lists the instrumentation classes. The instrumentation classes provides profiling and other informations. These informations are removed just before the application is published etc.

This is the required xml file for all the android application and located inside the root directory.

A simple AndroidManifest.xml file looks like this:



Elements of the AndroidManifest.xml file

The elements used in the above xml file are described below.

<manifest>



manifest is the root element of the AndroidManifest.xml file. It has package attribute that describes the package name of the activity class.


<application>



application is the subelement of the manifest. It includes the namespace declaration. This element contains several subelements that declares the application component such as activity etc.


The commonly used attributes are of this element are iconlabeltheme etc.
android:icon represents the icon for all the android application components.
android:label works as the default label for all the application components.
android:theme represents a common theme for all the android activities.

<activity>


activity is the subelement of application and represents an activity that must be defined in the AndroidManifest.xml file. It has many attributes such as label, name, theme, launchMode etc.
android:label represents a label i.e. displayed on the screen.
android:name represents a name for the activity class. It is required attribute.

<intent-filter>


intent-filter is the sub-element of activity that describes the type of intent to which activity, service or broadcast receiver can respond to.

<action>


It adds an action for the intent-filter. The intent-filter must have at least one action element.

<category>


It adds a category name to an intent-filter.

Dalvik Virtual Machine

As we know the modern JVM is high performance and provides excellent memory management. But it need to be optimized for low-powered handheld devices.

The Dalvik Virtual Machine (DVM) is optimized for mobile devices. It optimizes the JVM for memorybattery life andperformance.

Dalvik is a name of a town in Iceland. The Dalvik VM was written by Dan Bornstein.

The Dex compiler converts the class files into the .dex files that run on the Dalvik VM.

Let's see the compiling and packaging process from the source file:




The javac tool compiles the java source file into the class file.

The dx tool takes all the class files of your application and generates a single .dex file. It is a platform-specific tool.

The Android Assets Packaging Tool (aapt) handles the packaging process.

Thursday, 13 November 2014

Android Project Structure

Any Android project contain things such as application source code and resource files. Some are generated for you by default, while others should be created if required. Lets have a look at android eclipse project directory structure below :


 Src :

           The src folder contains the Java source code files of your application organized into packages. You can have more than one package in your Android application. Its always a good practice to break the source code of your application into different packages based on its core functionality.  All the source files of your Activities, Services etc. Goes into this folder. In the above screen, you can see the source file of the Activity that we created for our project.


Gen :

         The files in the gen folder are automatically generated by the ADT. Here the R.java file contains reference/id's  to all the resources in the res we use in our program. Each time we add a new resource to the project, ADT will automatically regenerate the R.java file containing reference to the newly added resource. You should not edit the contents of R.java file manually or otherwise your application may not compile.


ANDROID <version number> :

              This folder is also called Android target library in Android project structure. The version number will be  same as the build target version that we choose while creating a new project. The android.jar file contains all the essential libraries required for our program.

ASSETS

             The assets folder is used to store raw asset files. You can keep any raw data in the assets folder and there’s an asset manager in Android to read the data stored in the folder. The raw data can be anything such as audio, video, images etc. On important point about assets folder is that the data stored in this folder can’t be referenced by an ID. To access a data in this folder, we have to work with bits and bytes.

BIN :

      Bin folder is where our compiled application files go. When we successfully compile an application, this folder will contain java class files, dex files which are executable under Dalvik virtual machine, apk archives etc.

RES :

         Res folder is where we store all our external resources for our applications such as images, layout XML files, strings, animations, audio files etc.

Sub folders:

res/drawable

This folder contains the bitmap file to be used in the program. There are three different folders to store drawables. They are drawable-ldpi, drawable-mdpi, drawable-hdpi. The folders are to provide alternative image resources to specific screen configurations. Ldpi, mdpi & hdpi stands for low density, medium density & high density screens respectively. The resources for each screen resolutions are stored in respective folders and the android system will choose it according to the pixel density of the device.

res/layout

XML files that defines the User Interface goes in this folder.

res/values

XML files that define simple values such as strings, arrays, integers, dimensions, colors, styles etc. are placed in this folder.

res/menu

XML files that define menus in your application goes in this folder.

ANDROID MANIFEST FILE :

          AndroidManifest.xml is one of the most important file in the Android project structure. It contains all the information about your application. When an application is launched, the first file the system seeks is the AndroidManifest file. It actually works as a road map of your application, for the system.

              The Android Manifest file contains information about:

                               Components of your application such as Activities, services etc.
                               User permissions required
                               Minimum level of Android API required

IC_LAUNCHER-WEB.PNG :

             This is an icon to be used in Google play. Applications on Google Play require a high fidelity version of the application icon. It is not used in your actual app or the launcher, so it is not packaged in the APK.. The specifications for the high-resolution icon are:
32-bit PNG with an alpha channel
512 x 512 pixels
Maximum size of 1024KB

PROGUARD-PROJECT.TXT :

            Everything in the proguard-project.txt file will be in commented out state, because in general most people don't have any project specific needs, just to run ProGuard tool with standard settings.
The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. The result is a smaller sized .apk file that is more difficult to reverse engineer.

PROJECT.PROPERTIES :

             Project.properties is the main project’s properties file containing information such as the build platform target and the library dependencies has been renamed from default.properties in older SDK versions. This file is integral to the project.


Creating Simple Android Application

Creating Android Application 


1.Click on eclipse icon.

2.To create  android application goto File->New->Android Application.

3.Fill the Details in this dialog box and click finish.


4.Now an android project have been created. You can explore the android project and see the simple program, it looks like



5.Run the android application

              To run the android application:
              Right click on your project > Run As.. > Android Application  

Wednesday, 12 November 2014

Android Installation Procedure


Android Installation Procedure :


Android supports java, c++, c# etc. language to develop android applications. Java is the officially supported language for android. All the android examples of this site is developed using Java language and Eclipse IDE.

Here, we are going to tell you, the required softwares to develop android applications using Eclipse IDE.

Supported Operating Systems:

Windows
Mac
Linux


Required Softwares:



1. JDK (1.5 or later) 

        'download from here:http://www.oracle.com/technetwork/java/javase/downloads/index.html

2. ADT Bundle 

      download from here:http://developer.android.com/sdk/index.html

Installation Procedure:

1.Install JDK

2.Unzip ADT Bundle inside you will find two folders called eclipse,sdk.

3.do not separate eclipse and sdk from ADT bundle folder.

4.open eclipse folder and you will find eclipse application file just run that file it is going to open eclipse IDE after you can start android application development.

5.Create an Android Virtual Device (AVD).
          
           For running the android application in the Android Emulator, you need to create and AVD. 
           For creating the AVD:                       

                  1.Select the Window menu > AVD Manager.
                  2 .Click on the new button, to create the AVD.
                  3.Now a dialog appears, write the AVD name e.g. myavd. Now choose the target android                         version e.g. android4.0.
                 4.click the create AVD.


6.Install Tools and Extras folder in Android SDK Manager.

                1. Select the Window Android SDK Manager.
                2.Select tools and extras check box.    
                3.Click install packages.

Monday, 7 July 2014

Android Architecture

Android architecture  includes linux kernel, native libraries (middleware), Android Runtime, Application Framework and Applications.



Linux kernel

At the bottom of the layers is Linux - Linux 2.6 with approximately 115 patches. This provides basic system functionality like process management, memory management, device management like camera, keypad, display etc. Also, the kernel handles all the things that Linux is really good at such as networking and a vast array of device drivers, which take the pain out of interfacing to peripheral hardware.

Libraries

On top of Linux kernel there is a set of libraries including open-source Web browser engine WebKit, well known library libc, SQLite database which is a useful repository for storage and sharing of application data, libraries to play and record audio and video, SSL libraries responsible for Internet security etc.

Android Runtime

This is the third section of the architecture and available on the second layer from the bottom. This section provides a key component called Dalvik Virtual Machine which is a kind of Java Virtual Machine specially designed and optimized for Android.
The Dalvik VM makes use of Linux core features like memory management and multi-threading, which is intrinsic in the Java language. The Dalvik VM enables every Android application to run in its own process, with its own instance of the Dalvik virtual machine.
The Android runtime also provides a set of core libraries which enable Android application developers to write Android applications using standard Java programming language.

Application Framework

The Application Framework layer provides many higher-level services to applications in the form of Java classes. Application developers are allowed to make use of these services in their applications.

Applications

You will find all the Android application at the top layer. You will write your application to be installed on this layer only. Examples of such applications are Contacts Books, Browser, Games etc.

Friday, 4 July 2014

History of Android


The history and versions of android are interesting to know. The code names of android ranges from A to L currently, such  as Apple Pie, Banana Bread, Cupcake, Donut, Eclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwitch,Jelly Bean,KitKat and lollipop. Let's understand the android history pointy:

Initially, Andy Rubin founded Android Incorporation in Palo Alto, California, United States in October, 2003
In 17th August 2005, Google acquired android Incorporation. Since then, it is in the subsidiary of Google Incorporation.The key employees of Android Incorporation are Andy Rubin, Rich Miner, Chris White and Nick Sears.

Apple Pie - 1.0   (2008 Sep 23)


 API Level 1

  • Download and updates via Android Market
  • Web Browser
  • Camera support
  • Gmail, Contacts and Google Agenda synchronization     
  • Google Maps
  • Youtube Application                                     




Banana Bread - 1.1  (2009 Feb 9)


 API Level 2

  • "Show" & "Hide" numeric keyboard, in caller application
  • Ability to save MMS attachments




Cup Cake - 1.5   (2009 Apr 30)


 API Level 3

  •  Integration of home screen widgets
  •  Support for folders on home screen
  •  Stereo Bluetooth support
  •  Copy/paste in web browser
  •  Video recording and playback



 Donut - 1.6  (2009 Sep 15)

 API Level 4

  •  Quick search box
  •  Updated interface for camera
  •  Camcorder and gallery
  •  Updated Google Play (Android Market) 
  •  Battery usage indicator
  •  Text-to-speech engine

 Eclair - 2.0 (2009 Oct 26)

 API Level 5

  • Google Maps Navigator (beta)
  • Updated browser
  • Support for multiple accounts
  • Improved keyboard
  • SMS search
  • Exchange support


 Froyo - 2.2  2(2010 May 20)


 API Level 8
  • Support for Adobe Flash
  • Portable hotspots
  • Multiple keyboard languages
  • Speed and performance improvements
  • Enhanced Microsoft Exchange support

Ginger Bread - 2.3 (2010 Dec 6)

 API Level 9

  • UI refinements
  • NFC support
  • Native support for SIP VOIP
  • Faster/more intuitive text input
  • Enhanced copy and paste




HoneyComb - 3.0 (2011 Feb 22)

API Level 11

  • Revamped (holographic) UI designed specifically for tablets
  • Action bar
  • Improved multi-tasking
  • Updated standard Android apps
  • Better copy/paste
  • Redesigned keyboard





Ice Cream Sandwitch - 4.0 (2011 Oct 10)

API Level 14

  • Improved multi-tasking
  • Face unlock
  • Resizeable widgets
  • Android beam
  • Enhanced email options 
  • Improved text and voice input
  • Soft buttons can replace hard keys





Jelly Bean - 4.1 (2012 July 9)

API Level 16

  • larger, rich, and actionable notifications
  • Google Now
  • Offline voice dictation
  • Streamlined UI
  • Performance improvements “Project Butter”
  • Smart widget placement
  • Multi-user profiles for tablets (4.2)
  • Lock screen widgets (4.2)
  • Daydream (4.2)
  • OpenGL ES 3.0 (4.3)
  • Bluetooth Smart Ready (4.3)
  • Restricted user profiles for tablets (4.3)

KitKat - 4.4 (2013 Oct 13)

API Level 19

  • larger, rich, and actionable notifications
  • Google Now
  • Offline voice dictation
  • Streamlined UI
  • Performance improvements “Project Butter”
  • Smart widget placement
  • Multi-user profiles for tablets (4.2)
  • Lock screen widgets (4.2)
  • Daydream (4.2)
  • OpenGL ES 3.0 (4.3)
  • Bluetooth Smart Ready (4.3)
  • Restricted user profiles for tablets (4.3)



Lollipop - 4.5 (2013 June 25)

API Level 20

  • Battery saver mode
  • Useful notifications
  • Material Design
  • Meaningful relations between all manner of devices
  • Faster, better looking and more efficient






Thursday, 3 July 2014

About Android

What is Android?

Android is a software package and linux based operating system for mobile devices such as tablet computers and smartphones.
It is developed by Google and later the OHA (Open Handset Alliance). Java language is mainly used to write the android code even though other languages can be used.
The goal of android project is to create a successful real-world product that improves the mobile experience for end users.

What is Open Handset Alliance (OHA) ?

oha
It's a consortium of 84 companies such as google, samsung, AKM, synaptics, KDDI, Garmin, Teleca, Ebay, Intel etc.
It was established on 5th November, 2007, led by Google. It is committed to advance open standards, provide services and deploy handsets using the Android Plateform.









Features of Android

There are many advantages of android. They are as follows:
  • It is open-source.
  • Anyone can customize the Android Platform.
  • There are a lot of mobile applications that can be chosen by the consumer.
  • It provides many interesting features like weather details, opening screen, live RSS (Really Simple Syndication) feeds etc.
  • It provides support for messaging services(SMS and MMS), web browser, storage (SQLite), connectivity (GSM, CDMA, Blue Tooth, Wi-Fi etc.), media, handset layout etc.

Categories of Android applications

what is android
There are many android applications in the market. The top categories are:
  • Entertainment
  • Tools
  • Communication
  • Productivity
  • Personalization
  • Music and Audio
  • Social
  • Media and Video
  • Travel and Local etc.