Android Programming Long Questions and AnswersHere in this section of Android Programming Long Questions and Answers,We have listed out some of the important Long Questions with Answers on Android Manifest File which will help students to answer it correctly in their University Written Exam.

 

 
Q-1 What is the use of Manifest file in android application? Explain it.

 

Every application must have an AndroidManifest.xml file in its root directory

The manifest file provides essential information about your app to the Android system, which the system must have before it can run any of the app’s code.

 

Among other things, the manifest file does the following:

  • 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, which include the activities, services, broadcast receivers, and content providers that compose the application.
  • It determines the processes that host the application components.
  • It declares the permissions that 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 lists the Instrumentation classes that provide profiling and other information as the application runs. These declarations are present in the manifest only while the application is being developed and are removed before the application is published.
  • It declares the minimum level of the Android API that the application requires
  • It lists the libraries that the application must be linked against.

 

Manifest file structure

The code snippet below shows the general structure of the manifest file and every element that it can contain. Each element, along with all of its attributes, is fully documented in a separate file.

 

Here is an example of the manifest file:

<?xml version="1.0" encoding="utf-8"?>

<manifest>

<uses-permission />

<permission />

<uses-sdk />

<uses-configuration />

<uses-feature />

<supports-screens />

<application>

<activity>

<intent-filter>

<action />

<category />

<data />

</intent-filter>

<meta-data />

</activity>

<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>

</application>

</manifest>

 

  • Only the <manifest> and <Application>elements are required.
  • They each must be present and can occur only once
  • Most of the other elements can occur many times or not at all.
  • The <Application> element must be the last element inside the <manifest> element.
  • In other words, the The </Application> closing tag must appear immediately before the </manifest> closing tag. Except for some attributes of the root <manifest> element, all attribute names begin with an android: prefix.
  • A permission is a restriction that limits access to a part of the code or to data on the device
  • The limitation is imposed to protect critical data and code that could be misused to distort or damage the user experience

 

If an application needs access to a feature that is protected by a permission, it must declare that it requires the permission with a <uses-permission>element in the manifest.

 

Share with : Share on Linkedin Share on Twitter Share on WhatsApp Share on Facebook