Android - What does android application contain ?

Android application consists of loosely coupled components, bound by the application manifest. This manifest file will describe about each component and how they all interact, as well as the application metadata including its hardware and platform requirements. For example :

This manifest file will declare all activities, services, broadcast receivers and content provider of the application. It will also contain the required permissions for the application. For example if the application requires network access it must be specified here. "AndroidManifest.xml" can be thought as the deployment descriptor for an Android application.
                                                                                Figure 1-6
The "package" attribute defines the base package for the following Java elements. It is also unique as the Android Marketplace only allows application for a specfic package once. Therefore a good habit is to use your reverse domain name as a package to avoid collisions with other developers.
"android:versionName" and "android:versionCode" specify the version of your application. "versionName" is what the user sees and can be any string. "versionCode" must be an integer and the Android Market uses this to determine if you provided a newer version to trigger the update on devices which have your application installed. You typically start with "1" and increase this value by one if you roll-out a new version of your application.
"activity" defines an activity in this example pointing to the class "CelFahConverterActivity". For this class an intent filter is registered which defines that this activity is started once the application starts (action android:name="android.intent.action.MAIN"). The category definition (category android:name="android.intent.category.LAUNCHER" ) defines that this application is added to the application directory on the Android device. The @ values refer to resource files which contain the actual values. This makes it easy to provide different resources, e.g. strings, colors, icons, for different devices and makes it easy to translate applications.
The "uses-sdk" part of the "AndroidManifest.xml" defines the minimal SDK version your application is valid for. This will prevent your application being installed on devices with older SDK versions.

Building blocks of android application are :
  • Activities : It is the presentation layer. Every screen of your application will be an extension of the Activity Class.
  • Services : The invisible workers of your application are called services. Service components run in the background, updating your data sources and visible Activities and triggering notifications. These services are used to perform regular processing that needs to continue even when your application's activities aren't active or visible.
  • Content Providers : Share-able data stores. They are preferred mean of sharing data across application boundaries. You can configure your content own content providers to permit access from other applications and use content providers exposed by other applications to access their stored data.
  • Intent : An inter application message - passing framework. Using Intents you can broadcast messages system - wide or to a target Activity or Service.
  • Broadcast Receivers : Intent broadcast consumers. If you create and register a Broadcast Receiver, your application can listen for broadcast Intents that match specific filter criteria. Broadcast Receivers will automatically start your application to respond to an incoming Intent, making them perfect for creating event - driven applications.
  • Notifications : A user notification framework. Notifications let you signal users without stealing focus or interrupting  their current activities.

Comments

Popular posts from this blog

public vs protected vs default access modifiers - Java

Class, Reference and Object