The loosely coupled components (e.g. activities and services) are stitched together by the AndroidManifest.xml
file at runtime. This file describes each of your components and how they work together. You don't register fragments here because they are transient and tied to the activity that hosts them.
In this file you specify which activity (or activities) that are launchable. You can specify how things are launched, how to handle orientations, testing application information (when using instrumentation), and how to handle the SD card. Finally, you specify metadata about the application like the name, version name, version code, icon, and theme.
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.colabug.calc"
android:versionCode="1"
android:versionName="1.0">
<application
android:label="@string/app_name"
android:icon="@drawable/calc_icon">
<activity
android:name="CalculatorActivity">
</activity>
</application>
</manifest>
The package
specifies the package structure for your application and is used to uniquely identify your application in the market.
The application label
refers to a string resource that will be shown on the launch grid of the device. Using a string resource allows you to customize for internationalization. We'll cover resources more in depth later.
The versionName
is a public-facing name for the version of the application. The versionCode
is an integer value. You should increase it for each release to the market and generally when developing the application and doing internal releases. The version code combined with the signature and package name is what tells Android device users that there is an update for their phone.
Inside the <application>
tag, you specify the activities and services that you will use in the application.
If you create an activity and don't register it in the manifest, you will get a crash with a surprisingly helpful error message.
This file is also used as a filter by the Google Play store. You can specify application permissions, what hardware features you require, and what OS versions you support.
If the user's device doesn't support one of your requirements, then it won't be shown in search results when they search on the device. If they search on the web, they will find your app, but won't be able to install on devices that don't support your application's requirements.
You can find more about filtering in the store here: http://developer.android.com/google/play/filters.html