About android


Android is a free open source mobile platform. As I mentioned earlier, it is a Linux based, multi process, multi threaded operating system. It is neither a device nor a product. Neither it is only limited to phones, we could build a handheld GPS, mp3 player or many other different types of devices.

Android applications are written in Java programming language. Compiled source code along with resources and other assets are packaged int an .apk file. This file could be used for distributing the application on different android phones.

Android environment is almost like any other workstation environment but it is made more secure and resource efficient.

  • In android all the applications runs in it own process space. Android starts a process as and when it is required and it shuts it down when it is no longer needed and the resource is required by other processes.
  • Each application runs in its own virtual machine. This protects an application to corrupt other applications.
  • Each application is assigned a unique Linux user ID. Permissions are set so that the application’s files are visible only to that user and only to the application itself — although there are ways to export them to other applications as well.
  • Android application components

    Good thing about android is that an application can use the components of other applications if they allow it. For example if you need the image gallery or contact list to be displayed in your application then you need not implement those components from scratch. You can easily use the native application components. Your application does not incorporate with code of other application. It just invokes it.

    To accomplish this application needs to be designed and instantiated in slightly different way. There are many components that can be defined and instantiated as they are required.

    There are four types of components:

    Activities

    An activity presents a visual interface. As it is defined literally an activity represents a task that user can perform, ACtivity in android application is the mean of allowing user to performs his tasks. It could be either making a phone call, taking snaps, watching videos, browsing or as simple as filling up form and viewing it.

    An application can contain any number of activities. Each activity is assigned with a window where it is drawn. But it could be of smaller size and can be placed on the screen in all the three direction (x, y & z).

    An activity can also contain child activity like dialog boxes, toast, etc.

    In an application the class representing the user interface must implement Activity class. Each components inside an activity is derived from View class. These components are called widgets or views. There are variety of widgets predefined in android which can be easily used to form the complete user interface.

    Content Providers

    Content providers provide the abstraction made any set of data available for multiple applications to use. For example if you have certain records in SQLITE database and those records could be used by other applications too then you should consider making a content provider. The best example is contact application. All the contacts are stored in a particular database. And all the application in need of those contact don’t have to implement the database interface. They just use Contact content provider. Any application that needs to implement content provider has to implement ContentProvider base class and implement few set of methods to make it work.

    Services

    Services doesn’t have user interface, they always run in background for infinite time. They can be only communicated with provided activity. For example media player. Media player always has a user interface to play, pause, stop the songs. This user interface is the way to communicate with media player service which allows song to be played even if user is not on media player user interface.

    User can play a song or download some data while he is busy editing his favorite photographs. Services never run in the main thread. They always run in separate thread space and therefore never blocks any other activities.

    Broadcast Receiver

    Broadcast receiver can only receive and react on message broadcasts. System generates lots of broadcasts for example, when there is an incoming call, or a message is received, or when user preferences has changed like language, etc.

    An application can contain any number of broadcast receiver and each of them is required to be derived from BroadcasrReceiver class. Broadcast receiver does’t have a user interface but they can start the activities to notify user about recent events.. They can also use NotificationManager to notify user in different ways like flashing light, viberate etc.

    Intent

    An intent is an Intent object that holds the content of the message that is used to activate Activities, Broadcast receiver or service. Content provider is activated when they are targeted by ContentResolver.

    An intent object contains the action as well as optional data uri on which the activity or any other component can operate.

    Advertisements

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s