Wednesday, May 16, 2012

1. What is Android?

1.1. Android Operation System

Android is an operating system based on Linux with a Java programming interface.
The Android Software Development Kit (Android SDK) provides all necessary tools to develop Android applications. This includes a compiler, debugger and a device emulator, as well as its own virtual machine to run Android programs.
Android is currently primarily developed by Google.
Android allows background processing, provides a rich user interface library, supports 2-D and 3-D graphics using the OpenGL libraries, access to the file system and provides an embedded SQLite database.
Android applications consist of different components and can re-use components of other applications. This leads to the concept of a task in Android; an application can re-use other Android components to archive a task.
For example you can write an application which use the Android Gallery application to pick a photo.

1.2. Google Play (Android Market)

Google offers the Google Play service in which programmers can offer their Android application to Android users. Google phones include the Google Play application which allows to install applications.
Google Play also offers an update service, e.g. if a programmer uploads a new version of his application to Google Play, this service will notify existing users that an update is available and allow to install it.
Google Play used to be called Android Market.

1.3. Security and permissions

During deployment on an Android device, the Android system will create a unique user and group ID for every Android application. Each application file is private to this generated user, e.g. other applications cannot access these files.
In addition each Android application will be started in its own process.
Therefore by means of the underlying Linux operating system, every Android application is isolated from other running applications.
If data should be shared, the application must do this explicitly, e.g. via a Service or a ContentProvider.
Android also contains a permission system. Android predefines permissions for certain tasks but every application can define additional permissions.
An Android application declare its required permissions in its AndroidManifest.xml configuration file.For example an application may declare that it requires Internet
Permissions have different levels. Some permissions are automatically granted by the Android system, some are automatically rejected.
In most cases the requested permissions will be presented to the user before installation of the application. The user needs to decided if these permissions should be given to the application.
If the user denies a permission required by the application, this application cannot be installed. The check of the permission is only performed during installation, permissions cannot be denied or granted after the installation.
While not all users pay attention to the required permissions during installation some some users do and they write bad reviews on Google Play.

2. Android components

The following gives a short overview of the most important Android components.

2.1. Activity

Activity represents the presentation layer of an Android application. A simplified description is that an Activity represents a screen in your Android application. This is slightly incorrect as Activities can be displayed as Dialogs or can be transparent.
An Android application can have several Activities.

2.2. Views and ViewGroups

Views are user interface widgets, e.g. buttons or text fields. The base class for all Views is android.view.View. Views often have attributes which can be used to change their appearance and behavior.
A ViewGroup is responsible for arranging other Views. A ViewGroup is also called layout manager. The base class for a layout manager is android.view.ViewGroups which extends View.
ViewGroups can be nestled to create complex layouts. You should not nestle ViewGroups too deeply as this has a negative impact on the performance.

2.3. Intents

Intents are asynchronous messages which allow the application to request functionality from other components of the Android system, e.g. from Services or Activities. An application can call a component directly (explicit Intent ) or ask the Android system to evaluate registered components for a certain Intent (implicit Intents ). For example the application could implement sharing of data via an Intent and all components which allow sharing of data would be available for the user to select. Applications register themselves to an Intent via an IntentFilter.
Intents allow to combine loosely coupled components to perform certain tasks.

2.4. Services

Services perform background tasks without providing a user interface. They can notify the user via the notification framework in Android.

2.5. ContentProvider

ContentProvider provides a structured interface to application data. Via a ContentProvider your application can share data with other applications. Android contains an SQLite database which is frequently used in conjunction with a ContentProvider. The SQLite database would store the data, which would be accessed via the ContentProvider.

2.6. BroadcastReceiver

BroadcastReceiver can be registered to receive system messages and Intents. A BroadcastReceiver will get notified by the Android system, if the specified situation happens. For example a BroadcastReceiver could get called once the Android system completed the boot process or if a phone call is received.

2.7. (HomeScreen) Widgets

Widgets are interactive components which are primarily used on the Android homescreen. They typically display some kind of data and allow the user to perform actions via them. For example a Widget could display a short summary of new emails and if the user selects an email, it could start the email application with the selected email.

2.8. Other

Android provide many more components but the list above describes the most important ones. Other Android components are "Live Folders" and "Live Wallpapers". Live Folders display data on the homescreen without launching the corresponding application.