Monday, 11 March 2013

What is Android? Basic Compoments of Android and Intent.

Android :- is a stack of software for mobile device which includes an operating system, middleware and some more key application. The application executes within its own process and its own instance of dalvik virtual machine.Many virtual machine run efficiently by a DVM device. DVM executes Java languages byte code which later transform into .dex format files.

Basic Components of Android Application

1.) Service :- like network operations.

2.)  Intent : - to perform inter-communication between activities and services.

3.) Resource Externalization :- such as strings and graphics.

4.)  Notification Signaling user :- light, sound, icon , notification , dialog etc

5.)  Content Provide :- They share data between application.

What is Intent?

A class which describes what a caller is dersireto do, The Caller will send this intent to Android's intent resolver , which find the most suitable activity for the intent .Ex Opening a PDF document is an intent.

Intent are asynchronous message which allow Android components to request functionality from other components of teh android system. Intent can be used to signal to the Android system that a certain event has occured.

Intent are send to the android system via a method call e.g. via the startActivity() method you can start activities. Depending upon how the intent was constructed the android system will run a receiver determination and determine possible components which can be started.

An intent can contain data.This data can be used by the receiver component. For e.g. you application can start a browser component via intent. As data it may send the URL to teh browser component which thisbrowser should open and display.

String url = "";
Intent i = new Intent (Intent.ACTION_VIEW);

Explicit Intents :- Explicit intents explicitly defines the component which should be called by the Android system, by using the Java class as identifier.

Intent i = new Intent(this, ActivityTwo.class);
i.putExtra("value1","This value one for activity two");
iputExtra("value2","This value two for activity two");

Implicit Intents :- Emplicit intents specify the action which should be performed and optionally data which provides data for action.

Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://"));

If these intents are send to the android system, it searches for all the components which are registered for the specific action and the Data Type.

Data Transfers :- An implicit intent contains the actions and optionally additional data.The receiveing component can get this information via the getAction() and getData() methods on the Intent object.

Intent Filters :- If an intent is send to the Android system, it will determine suitable application for this intents. If several components have been registered for this type of Intents, Android offers the user the choice to open of them.

This determination is based on IntentFilters. An IntentFilters specifies the type of Intent that an activity, service or broadcast Receiver can respond to. An Intent Filter declare the capabilities of the component .If specifies when an activity or service can do and what an activity or service can do and what tyoe of broadcasts or Receiver can handle. It allows a corresposnding component to receive intents of teh delcared type.

Intent Filters are typically defined via the AndroidManifest.xml file . For the BroadcastReceiver it is also possible to define by them in coding.An IntentFilters is defined by its category , action and data filters. Its can also contain additional metadata.

An android application is delivered in .apk format extension. ".apk file" is compressed Android Manifest xml with extension ".apk". It also include the application code (.dex files), resource files and other files which are compressed into a single .apk file.

No comments:

Post a Comment