AndroidManifest.xml
Before we start,
manifest(noun) definition:- A document giving the details of a ship and its cargo, passengers, and crew for the use of customs officers.
Here for android, the ship is your application. This file is like a blueprint for your application. Lists out its contents, parameters and requirements. It is found in the root directory of your application project. So what does this file do? Lets look at an example:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="my.tracker.app"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="8" />
<application android:icon="@drawable/launcherIcon" android:label="@string/app_name">
<activity android:name=".SendActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
package= refers to your application package. The application may ask for permissions from the users, say to access the internet or the GPS, which you see in the uses permission tag.
The
minSdkVersion refers to the minimum android version build your application is designed for.Then we come to the
application tag. Your android application can contain "Activities". An activity is something that goes on your screen. Naturally, an application can contain more than one activity. You might say that an activity is a function in a broad sense. Like in C/C++ which contain an entry point to the program through a main function, Your android application too should contain a "Main" activity. The sample code above says that there is an activity of name "SendActivity" and it is mentioned as the "MAIN" by the use of the intent-filter tag with "android.intent.action.MAIN". The "android.intent.category.LAUNCHER" value in the category tag informs that this activity has the launcher icon which is referenced by android:icon="@drawable/icon", where @drawable is the folder in which the launcherIcon image is to be found.Coming soon, Part 2 in the Android for Dorks series.
No comments:
Post a Comment