Wednesday, 7 August 2013

Importance of AndroidManifest.xml file in Android Application Code

Hello Guys! Hope You All are doing well. Today i am going to shows the importance of manifest file in Android App Development. Generally beginner of Android App developer  forget to pay much attention of AndroidManifest.xml in Android App development. The importance of Manifest file in Android App Development is huge. So today  I am going to put some light on it. 
The manifest file is the foundation for any Android application. Every application must have an AndroidManifest.xml(exact like here given name) file in its root directory. The manifest presents essential information about the application to the Android system, information the system must have before it can run any of the application's code. The manifest file organizes an Android application into a well-defined structure that is shared by all applications and enables the Android operating system to load and execute them in a managed environment. The manifest file does the following things:-
  • It names the Java package for the application. The package name serves as a unique identifier for the application.
  • It describes the components of the application - the activities, services, broadcast receivers, and content providers that the application is composed of.
  • It determines which processes will host application components.
  • It declares which permissions the application must have in order to access protected parts of the API and interact with other applications.
  • It also declares the permissions that others are required to have in order to interact with the application's components.
  • It declares the minimum level of the Android API that the application requires.
  • It lists the libraries that the application must be linked against.
Structure of the Manifest File
The Structure of manifest file looks like this. 
<?xml version="1.0" encoding="utf-8"?>

<manifest>

   
<uses-permission />
   
<permission />
   
<permission-tree />
   
<permission-group />
   
<instrumentation />
   
<uses-sdk />
   
<uses-configuration />
   
<uses-feature />
   
<supports-screens />
   
<compatible-screens />
   
<supports-gl-texture />

   
<application>

       
<activity>
           
<intent-filter>
               
<action />
               
<category />
               
<data />
           
</intent-filter>
           
<meta-data />
       
</activity>

       
<activity-alias>
           
<intent-filter> . . . </intent-filter>
           
<meta-data />
       
</activity-alias>

       
<service>
           
<intent-filter> . . . </intent-filter>
           
<meta-data/>
       
</service>

       
<receiver>
           
<intent-filter> . . . </intent-filter>
           
<meta-data />
       
</receiver>

       
<provider>
           
<grant-uri-permission />
           
<meta-data />
           
<path-permission />
       
</provider>

       
<uses-library />

   
</application>

</manifest>
 Now I am going to show all these tags use case in detail(not to much! Do not afraid !!! hehehe...)
Note:- The root element of the AndroidManifest.xml file.  It must contain an <application> element and specify xmlns:android and package attributes.
1. <manifest> Tags:-
The syntax of manifest file loooks like this. The attributes contain this tag is shown below.  The starting attributes or element of manifest file is xmlns:android= "". 
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
         
package="string"
         
android:sharedUserId="string"
         
android:sharedUserLabel="string resource"
         
android:versionCode="integer"
         
android:versionName="string"
         
android:installLocation=["auto" | "internalOnly" | "preferExternal"] >
    . . .
</manifest>
Defines the Android namespace.
This attribute should always be set to "http://schemas.android.com/apk/res/android".
package
A full Java-language-style package name for the application. The name should be unique. The package name serves as a unique identifier for the application. It's also the default name for the application process
android:sharedUserId
The name of a Linux user ID that will be shared with other applications. By default, Android assigns each application its own unique user ID. However, if this attribute is set to the same value for two or more applications, they will all share the same ID — provided that they are also signed by the same certificate.
Application with the same user ID can access each other's data and, if desired, run in the same process.
android:sharedUserLabel
A user-readable label for the shared user ID. The label must be set as a reference to a string resource;
 it cannot be a raw string. This attribute was introduced in API Level 3. It is meaningful only if the sharedUserId attribute is also set.
android:versionCode
it is used  version of android API. If you want to compile your android Application on android API 7.
You hvae to put here 7. If you compile Android application on API 7 it going to run all Android device
having version 7 or higher than 7. but reverse it not true(it not run Android device if version is less than 7).
It gives Parse Error.
android:versionName
It is user point of view  App version name. as for example if you puplish
your application First time put this version name = "1.0.0". In next update put it like versionname = "1.0.1".
 So that user understand that it is new update of this application and they update it( google play automaticaaly send notification for Updation)
android:installLocation
This tag defined where your application installed in device(internal or external memory). It has three attributes internalOnly:- if use this one then your application installed in internal memory of device.The application will never be installed on the external storage. If the internal storage is full, then the system will not install 
the application. This is also the default behavior if you do not define android:installLocation. 
auto: The application may be installed on the external storage, but the system will install the application on the internal storage by default. If the internal storage is full, then the system will install it on the external storage. Once installed, the user can move the application to either internal or external storage 
through the system settings.
preferExternal:- The application prefers to be installed on the external storage (SD card). There is no guarantee that the system will honor this request.
Manifest file must contain <application >tag and can contain
<uses-permission />
<permission />
<permission-tree />
<permission-group />
<instrumentation />
<uses-sdk />
<uses-configuration />
<uses-feature />
<supports-screens />
<compatible-screens />
<supports-gl-texture />  
2. <uses-permission> 
Requests a permission that the application must be granted in order for it to operate correctly. Permissions are granted by the user when the application is installed, not while it's running.
SYNTAX:
<uses-permission android:name="string" />
android:name
The name of the permission such as "android.permission.CAMERA" or "android.permission.READ_CONTACTS
3. <permission>
Declares a security permission that can be used to limit access to specific components or features of this or other applications. You can use this to define your own  Permission for your application.
SYNTAX
<permission android:description="string resource"
            android:icon="drawable resource"
            android:label="string resource"
            android:name="string"
            android:permissionGroup="string"
            android:protectionLevel=["normal" | "dangerous" | 
                                     "signature" | "signatureOrSystem"] />
ATTRIBUTES:
android:description
A user-readable description of the permission, longer and more informative than the label
android:icon
A reference to a drawable resource for an icon that represents the permission.
android:label
A name for the permission, one that can be displayed to
android:name
The name of the permission. This is the name that will be used in code to refer to the permission — for example, in a <uses-permission> element and the permission attributes of application components.
The name must be unique, so it should use Java-style scoping — for example, "com.example.project.PERMITTED_ACTION".
android:permissionGroup
Assigns this permission to a group. The value of this attribute is the name of the group, which must be declared with the <permission-group> element in this or another application. If this attribute is not set, the permission does not belong to a group
android:protectionLeve
Characterizes the potential risk implied in the permission and indicates the procedure the system should follow when determining whether or not to grant the permission to an application requesting it. The value can be set to one of the following strings:
"normal" :- The default value. A lower-risk permission that gives requesting applications access to isolated application-level features, with minimal risk to other applications, the system, or the use
"dangerous":- A higher-risk permission that would give a requesting application access to private user data or control over the device that can negatively impact the user. Because this type of permission introduces potential risk, the system may not automatically grant it to the requesting application. For example, any dangerous permissions requested by an application may be displayed to the user and require confirmation before proceeding
"signature":- A permission that the system grants only if the requesting application is signed with the same certificate as the application that declared the permission. If the certificates match, the system automatically grants the permission without notifying the user or asking for the user's explicit approval
"signatureOrSystem":- A permission that the system grants only to applications that are in the Android system image or that are signed with the same certificate as the application that declared the permission. Please avoid using this option, as the signature protection level should be sufficient for most needs and works regardless of exactly where applications are installed. The "signatureOrSystem" permission is used for certain special situations where multiple vendors have applications built into a system image and need to share specific features explicitly because they are being built together.
4. <permission-tree>
Declares the base name for a tree of permissions. The application takes ownership of all names within the tree. It can dynamically add new permissions to the tree by calling PackageManager.addPermission(). Names within the tree are separated by periods ('.'). For example, if the base name is com.example.project.taxes, permissions like the following might be added:
com.example.project.taxes.CALCULATE 
com.example.project.taxes.deductions.MAKE_SOME_UP 
com.example.project.taxes.deductions.EXAGGERATE
Note that this element does not declare a permission itself, only a namespace in which further permissions can be placed. See the <permission> element for information on declaring permissions.
SYNTAX
<permission-tree android:icon="drawable resource"
                 android:label="string resource" ]
                 android:name="string" />
5.<permission-group>
Declares a name for a logical grouping of related permissions. Individual permission join the group through the permissionGroup attribute of the <permission> element. Members of a group are presented together in the user interface.
Note that this element does not declare a permission itself, only a category in which permissions can be placed. See the <permission> element for element for information on declaring permissions and assigning them to groups.
SYNTAX
<permission-group android:description="string resource"
                  android:icon="drawable resource"
                  android:label="string resource"
                  android:name="string" />
6. <instrumentation>
Declares an Instrumentation class that enables you to monitor an application's interaction with the system. The Instrumentation object is instantiated before any of the application's components.
SYNTAX
<instrumentation android:functionalTest=["true" | "false"]
                 android:handleProfiling=["true" | "false"]
                 android:icon="drawable resource"
                 android:label="string resource"
                 android:name="string"
                 android:targetPackage="string" />
ATTRIBUTES:
android:functionalTest
Whether or not the Instrumentation class should run as a functional test — "true" if it should, and "false" if not. The default value is "false".
android:handleProfiling
Whether or not the Instrumentation object will turn profiling on and off — "true" if it determines when profiling starts and stops, and "false" if profiling continues the entire time it is running. A value of "true" enables the object to target profiling at a specific set of operations. The default value is "false".
android:name
The name of the Instrumentation subclass. This should be a fully qualified class name (such as, "com.example.project.StringInstrumentation"). However, as a shorthand, if the first character of the name is a period, it is appended to the package name specified in the <manifest> element.
There is no default. The name must be specified.
android:targetPackage
The application that the Instrumentation object will run against. An application is identified by the package name assigned in its manifest file by the <manifest> element.
7. <uses-sdk>
It show the Android platform level. It means in with Android API you have used to compile this Application. It also give the access of all available resource for that particular API level. If You used API level 8 then all the available resource of android you can use for your application.
SYNTAX
<uses-sdk android:minSdkVersion="integer"
          android:targetSdkVersion="integer"
          android:maxSdkVersion="intege
android:minSdkVersion
An integer designating the minimum API Level required for the application to run. The Android system will prevent the user from installing the application if the system's API Level is lower than the value specified in this attribute. You should always declare this attribute.
android:targetSdkVersion
An integer designating the API Level that the application targets. If not set, the default value equals that given to minSdkVersion.This attribute informs the system that you have tested against the target version and the system should not enable any compatibility behaviors to maintain your app's forward-compatibility with the target version. The application is still able to run on older versions (down to minSdkVersion).
android:maxSdkVersion
An integer designating the maximum API Level on which the application is designed to run.
Warning: Declaring this attribute is not recommended. First, there is no need to set the attribute as means of blocking deployment of your application onto new versions of the Android platform as they are released.
8. <uses-configuration>
Indicates what hardware and software features the application requires. For example, an application might specify that it requires a physical keyboard or a particular navigation device, like a trackball. The specification is used to avoid installing the application on devices where it will not work.
SYNTAX






<uses-configuration
  android:reqFiveWayNav=["true" | "false"] 
  android:reqHardKeyboard=["true" | "false"]
  android:reqKeyboardType=["undefined" | "nokeys" | "qwerty" | "twelvekey"]
  android:reqNavigation=["undefined" | "nonav" | "dpad" | "trackball" | "wheel"]
  android:reqTouchScreen=["undefined" | "notouch" | "stylus" | "finger"] />
ATTRIBUTES:
android:reqFiveWayNav
Whether or not the application requires a five-way navigation control — "true" if it does, and "false" if not. A five-way control is one that can move the selection up, down, right, or left, and also provides a way of invoking the current selection. It could be a D-pad (directional pad), trackball, or other device.
android:reqHardKeyboard
Whether or not the application requires a hardware keyboard — "true" if it does, and "false" if not.
android:reqKeyboardType
The type of keyboard the application requires, if any at all. This attribute does not distinguish between hardware and software keyboards. If a hardware keyboard of a certain type is required, specify the type here and also set the reqHardKeyboard attribute to "true".
"undefined" The application does not require a keyboard. (A keyboard requirement is not defined.) This is the default value.
"nokeys" The application does not require a keyboard.
"qwerty" The application requires a standard QWERTY keyboard.
"twelvekey" The application requires a twelve-key keypad, like those on most phones — with keys for the digits from 0 through 9 plus star (*) and pound (#) keys.
android:reqNavigation
The navigation device required by the application, if any. The value must be one of the following strings:
"undefined" The application does not require any type of navigation control. (The navigation requirement is not defined.) This is the default value.
"nonav" The application does not require a navigation control.
"dpad" The application requires a D-pad (directional pad) for navigation.
"trackball" The application requires a trackball for navigation.
"wheel" The application requires a navigation wheel.
android:reqTouchScreen
The type of touch screen the application requires, if any at all. The value must be one of the following strings:
"undefined" The application doesn't require a touch screen. (The touch screen requirement is undefined.) This is the default value.
"notouch" The application doesn't require a touch screen.
"stylus" The application requires a touch screen that's operated with a stylus.
"finger" The application requires a touch screen that can be operated with a finger.
9.<uses-feature>
Declares a single hardware or software feature that is used by the application.
The purpose of a <uses-feature> declaration is to inform any external entity of the set of hardware and software features on which your application depends. The element offers a required attribute that lets you specify whether your application requires and cannot function without the declared feature, or whether it prefers to have the feature but can function without it.
SYNTAX






uses-feature
  android:name="string"
  android:required=["true" | "false"]
  android:glEsVersion="integer" />
You must specify each feature in a separate <uses-feature> element, so if your application requires multiple features, it would declare multiple <uses-feature> elements. For example, an application that requires both Bluetooth and camera features in the device would declare these two elements:
<uses-feature android:name="android.hardware.bluetooth" />
<uses-feature android:name="android.hardware.camera" />
10.<supports-screens>
Lets you specify the screen sizes your application supports and enable screen compatibility mode for screens larger than what your application supports. It's important that you always use this element in your application to specify the screen sizes your application supports.
It gives flexibility in your application. You are Using different layout and image for different types. it is ok but due to numerous Android Device it help you out.
SYNTAX
<supports-screens android:resizeable=["true"| "false"]
                  android:smallScreens=["true" | "false"]
                  android:normalScreens=["true" | "false"]
                  android:largeScreens=["true" | "false"]
                  android:xlargeScreens=["true" | "false"]
                  android:anyDensity=["true" | "false"]
                  android:requiresSmallestWidthDp="integer"
                  android:compatibleWidthLimitDp="integer"
                  android:largestWidthLimitDp="integer"/>
11.<compatible-screens>
Specifies each screen configuration with which the application is compatible. The Android system does not read the <compatible-screens> manifest element (neither at install-time nor at run time) This element is informational only and may be used by external services (such as Google Play) to better understand the application's compatibility with specific screen configurations and enable filtering for users.
SYNTAX
<compatible-screens>
    <screen android:screenSize=["small" | "normal" | "large" | "xlarge"]
            android:screenDensity=["ldpi" | "mdpi" | "hdpi" | "xhdpi"] />
    ...</compatible-screens>
If your application is compatible with only small and normal screens, regardless of screen density, then you must specify eight different <screen> elements, because each screen size has four different density configurations. Like this
<manifest ... >
  ...
 <compatible-screens>
 <!-- all small size screens -->
  <screen android:screenSize="small" android:screenDensity="ldpi" />
  <screen android:screenSize="small" android:screenDensity="mdpi" />
   <screen android:screenSize="small" android:screenDensity="hdpi" />
   <screen android:screenSize="small" android:screenDensity="xhdpi" />
  <!-- all normal size screens -->
  <screen android:screenSize="normal" android:screenDensity="ldpi" />
  <screen android:screenSize="normal" android:screenDensity="mdpi" />
  <screen android:screenSize="normal" android:screenDensity="hdpi" />
  <screen android:screenSize="normal" android:screenDensity="xhdpi" />
 </compatible-screens>
<application ... >
      ...
<application>
</manifest>
12.<application>
it is  declaration of the application. This element contains subelements that declare each of the application's components and has attributes that can affect all the components.
SYNTAX
<application android:allowTaskReparenting=["true" | "false"]
             android:allowBackup=["true" | "false"]
             android:backupAgent="string"
             android:debuggable=["true" | "false"]
             android:description="string resource"
             android:enabled=["true" | "false"]
             android:hasCode=["true" | "false"]
             android:hardwareAccelerated=["true" | "false"]
             android:icon="drawable resource"
             android:killAfterRestore=["true" | "false"]
             android:largeHeap=["true" | "false"]
             android:label="string resource"
             android:logo="drawable resource"
             android:theme="resource or theme"
    . . .</application>
ATTRIBUTES
android:allowTaskReparenting
Whether or not activities that the application defines can move from the task that started them to the task they have an affinity for.
android:allowbackup
Whether to allow the application to participate in the backup and restore infrastructure.The default value of this attribute is true
android:backupAgent
The name of the class that implement's the application's backup agent, a subclass of BackupAgent
Generally we did not use.
android:debuggable
Whether or not the application can be debugged, even when running on a device in user mode — "true" if it can be, and "false" if not. The default value is "false"
android:description
User-readable text about the application, longer and more descriptive than the application label. The value must be set as a reference to a string resource. Unlike the label, it cannot be a raw string. There is no default value.
android:enabled
Whether or not the Android system can instantiate components of the application
android:hasCode
Whether or not the application contains any code — "true" if it does, and "false" if not.
android:hardwareAccelerated
Whether or not hardware-accelerated rendering should be enabled for all activities and views in this application — "true" if it should be enabled, and "false" if not. The default value is "true" if you've set either minSdkVersion or targetSdkVersion to "14" or higher; otherwise, it's "false".
Starting from Android 3.0 (API level 11), a hardware-accelerated OpenGL renderer is available to applications, to improve performance for many common 2D graphics operations. When the hardware-accelerated renderer is enabled, most operations in Canvas, Paint, Xfermode, ColorFilter, Shader, and Camera are accelerated. This results in smoother animations, smoother scrolling, and improved responsiveness overall, even for applications that do not explicitly make use the framework's OpenGL libraries.
Note that not all of the OpenGL 2D operations are accelerated. If you enable the hardware-accelerated renderer, test your application to ensure that it can make use of the renderer without errors.
android:icon
An icon for the application as whole, and the default icon for each of the application's components.
android:killAfterRestore
Whether the application in question should be terminated after its settings have been restored during a full-system restore operation.The default is true, which means that after the application has finished processing its data during a full-system restore, it will be terminated.
android:largeHeap
Whether your application's processes should be created with a large Dalvik heap. This applies to all processes created for the application.
Most apps should not need this and should instead focus on reducing their overall memory usage for improved performance. Enabling this also does not guarantee a fixed increase in available memory, because some devices are constrained by their total available memory.
android:label
A user-readable label for the application as a whole, and a default label for each of the application's components.
android:logo
A logo for the application as whole, and the default logo for activities.
This attribute must be set as a reference to a drawable resource containing the image (for example "@drawable/logo"). There is no default logo.
android:theme
A reference to a style resource defining a default theme for all activities in the application. Individual activities can override the default by setting their own theme attributes.
13. <activity>
Declares an activity (an Activity subclass) that implements part of the application's visual user interface. All activities must be represented by <activity> elements in the manifest file. Any that are not declared there will not be seen by the system and will never be run.
CONTAINED IN:
<application>
CAN CONTAIN:
<intent-filter>
<meta-data>
SYNTAX
<activity android:allowTaskReparenting=["true" | "false"]
          android:alwaysRetainTaskState=["true" | "false"]
          android:clearTaskOnLaunch=["true" | "false"]
          android:configChanges=["mcc", "mnc", "locale",
               "touchscreen", "keyboard", "keyboardHidden",
                 "navigation", "screenLayout", "fontScale", "uiMode",
              "orientation", "screenSize", "smallestScreenSize"]
          android:enabled=["true" | "false"]
          android:exported=["true" | "false"]
          android:finishOnTaskLaunch=["true" | "false"]
          android:hardwareAccelerated=["true" | "false"]
          android:icon="drawable resource"
          android:label="string resource"
          android:launchMode=["multiple" | "singleTop" |
                              "singleTask" | "singleInstance"]
          android:multiprocess=["true" | "false"]
          android:name="string"
          android:permission="string"
          android:process="string"
          android:screenOrientation=["unspecified" | "behind" |
                                     "landscape" | "portrait" |
                                     "reverseLandscape" | "reversePortrait" |
                                     "sensorLandscape" | "sensorPortrait" |
                                     "userLandscape" | "userPortrait" |
                                     "sensor" | "fullSensor" | "nosensor" |
                                     "user" | "fullUser" | "locked"]
          android:theme="resource or theme" >   
    . . .</activity>
android:allowTaskReparenting
Whether or not the activity can move from the task that started it to the task it has an affinity for when that task is next brought to the front — "true" if it can move, and "false" if it must remain with the task where it started.The default value is "false".
android:alwaysRetainTaskState
Whether or not the state of the task that the activity is in will always be maintained by the system — "true" if it will be, and "false" if the system is allowed to reset the task to its initial state in certain situations. The default value is "false".
android:clearTaskOnLaunch
Whether or not all activities will be removed from the task, except for the root activity, whenever it is re-launched from the home screen — "true" if the task is always stripped down to its root activity, and "false" if not. The default value is "false".
android:configChanges
Lists configuration changes that the activity will handle itself. When a configuration change occurs at runtime, the activity is shut down and restarted by default, but declaring a configuration with this attribute will prevent the activity from being restarted. Instead, the activity remains running and its onConfigurationChanged() method is called.
android:enabled
Whether or not the activity can be instantiated by the system — "true" if it can be, and "false" if not. The default value is "true".
android:excludeFromRecents
Whether or not the task initiated by this activity should be excluded from the list of recently used applications ("recent apps"). That is, when this activity is the root activity of a new task, this attribute determines whether the task should not appear in the list of recent apps. Set "true" if the task should be excluded from the list; set "false" if it should be included. The default value is "false".
android:exported
Whether or not the activity can be launched by components of other applications — "true" if it can be, and "false" if not. If "false", the activity can be launched only by components of the same application or applications with the same user ID.
android:finishOnTaskLaunch
Whether or not an existing instance of the activity should be shut down (finished) whenever the user again launches its task (chooses the task on the home screen) — "true" if it should be shut down, and "false" if not. The default value is "false".
android:hardwareAccelerated
Whether or not hardware-accelerated rendering should be enabled for this Activity — "true" if it should be enabled, and "false" if not. The default value is "false". SAME AS MENTION IN aPPLICATION TAG.
android:icon
An icon representing the activity. The icon is displayed to users when a representation of the activity is required on-screen.
android:label
A user-readable label for the activity. The label is displayed on-screen when the activity must be represented to the user. It's often displayed along with the activity icon.
android:launchMode
An instruction on how the activity should be launched. There are four modes that work in conjunction with activity flags (FLAG_ACTIVITY_* constants).
android:multiprocess
Whether an instance of the activity can be launched into the process of the component that started it — "true" if it can be, and "false" if not. The default value is "false".
android:name
The name of the class that implements the activity, a subclass of Activity. The attribute value should be a fully qualified class name (such as, "com.example.project.ExtracurricularActivity"). However, as a shorthand, if the first character of the name is a period (for example, ".ExtracurricularActivity"), it is appended to the package name specified in the <manifest> element.
Once you publish your application, you should not change this name (unless you've set android:exported="false").
android:screenOrientation
The orientation of the activity's display on the device.
android:theme
A reference to a style resource defining an overall theme for the activity.
14. <intent-filter>
Specifies the types of intents that an activity, service, or broadcast receiver can respond to. An intent filter declares the capabilities of its parent component — what an activity or service can do and what types of broadcasts a receiver can handle. It opens the component to receiving intents of the advertised type, while filtering out those that are not meaningful for the component.
CONTAINED IN:
<activity>
<activity-alias>
<service>
<receiver>
MUST CONTAIN:
<action>
CAN CONTAIN:
<category>
<data>
Syntax
<intent-filter android:icon="drawable resource"
               android:label="string resource"
               android:priority="integer" >
    . . .</intent-filter>
android:priority
The priority that should be given to the parent component with regard to handling intents of the type described by the filter. This attribute has meaning for both activities and broadcast receivers:

  • It provides information about how able an activity is to respond to an intent that matches the filter, relative to other activities that could also respond to the intent. When an intent could be handled by multiple activities with different priorities, Android will consider only those with higher priority values as potential targets for the intent.
  • It controls the order in which broadcast receivers are executed to receive broadcast messages. Those with higher priority values are called before those with lower values. (The order applies only to synchronous messages; it's ignored for asynchronous messages.)
  • Use this attribute only if you really need to impose a specific order in which the broadcasts are received, or want to force Android to prefer one activity over others.
15. <action>

Adds an action to an intent filter. An <intent-filter> element must contain one or more <action> elements. If it doesn't contain any, no Intent objects will get through the filter
CONTAINED IN:
<intent-filter>
SYNTAX:
<action android:name="string" />
android:name
The name of the action. Some standard actions are defined in the Intent class as ACTION_string constants. To assign one of these actions to this attribute, pretend "android.intent.action." to the string that follows ACTION_. For example, for ACTION_MAIN, use "android.intent.action.MAIN" and for ACTION_WEB_SEARCH, use "android.intent.action.WEB_SEARCH".
For actions you define, it's best to use the package name as a prefix to ensure uniqueness. For example, a TRANSMOGRIFY action might be specified as follows:
<action android:name="com.example.project.TRANSMOGRIFY" />
16. <category>
Adds a category name to an intent filter.A string containing additional information about the kind of component that should handle the intent.  the Intent class defines several category constants, including these:
  • CATEGORY_BROWSABLE  The target activity can be safely invoked by the browser to display data referenced by a link — for example, an image or an e-mail message.
  • CATEGORY_GADGET  The activity can be embedded inside of another activity that hosts gadgets.
  • CATEGORY_HOME The activity displays the home screen, the first screen the user sees when the device is turned on or when the Home button is pressed.
  • CATEGORY_LAUNCHER  The activity can be the initial activity of a task and is listed in the top-level application launcher.
  • CATEGORY_PREFERENCE  The target activity is a preference panel.
SYNTAX
<category android:name="string" />
android:name
The name of the category. Standard categories are defined in the Intent class as CATEGORY_name constants. The name assigned here can be derived from those constants by prefixing "android.intent.category." to the name that follows CATEGORY_. For example, the string value for CATEGORY_LAUNCHER is "android.intent.category.LAUNCHER".
Custom categories should use the package name as a prefix, to ensure that they are unique.

8 comments:

  1. Thanks a lot Saurabh for shedding some light on AndroidMenifest.xml. I am new to android and this blog post is very useful for me. I have bookmarked this article for future reference.

    Thanks a lot for writing!
    Regards,
    Prasant Saxena
    Software Development Company

    ReplyDelete
  2. Thank you for writing this article.....

    ReplyDelete
  3. Thanks Prasant,
    Your comment is helpful to write some more ...
    keep Encouraging me .. and Feel free to ask on Any topic where you feel Any problem .
    So that I put my best to write on that.

    Thanks
    Saurabh Sharma

    ReplyDelete
  4. I’m really impressed with your blog article, such great & useful knowledge you mentioned here.This is awesome for all which I am like in this is blog... Thanks and Regards
    Mobile App Development Company
    Android app Development Company
    ios app development Company
    Mobile App Development Companies

    ReplyDelete

  5. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.
    iOS App Development Company
    iOS App Development Company

    ReplyDelete
  6. You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...
    Texting API
    Text message marketing
    Digital Mobile Marketing
    Sms API
    Sms marketing

    ReplyDelete
  7. Very useful information that you have shared and it is very useful to me.Thanks for sharing the information with us.

    mobile app development company in chennai

    ReplyDelete
  8. Ramma Foundation Repair is your trusted expert for Edmonton foundation repair, offering reliable solutions to ensure the stability and longevity of your home. Protect your investment with our skilled team and proven techniques.

    ReplyDelete

Build a Custom Kernel Module for Android

Hi Guys!!!Hope you are doing well !!!. Today I will describe how you can write a custom kernel module(Hello world) for Android and load it a...