Android Manifest Flashcards

1
Q

What is the actual use of Android Manifest

A

The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

android manifest file has package name

A

this is same as namespace
The Android build tools use this to determine the location of code entities when building your project. When packaging the app, the build tools replace this value with the application ID from the Gradle build files, which is used as the unique app identifier on the system and on Google Play

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

components

A

The components of the app, which include all activities, services, broadcast receivers, and content providers. Each component must define basic properties such as the name of its Kotlin or Java class. It can also declare capabilities such as which device configurations it can handle, and intent filters that describe how the component can be started.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

permissions

A

The permissions that the app needs in order to access protected parts of the system or other apps. It also declares any permissions that other apps must have if they want to access content from this app.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

h/w and s/w requirements

A

The hardware and software features the app requires, which affects which devices can install the app from Google Play.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

package name

A

For example, the following snippet shows the root element with the package name “com.example.myapp”:

...
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

While building your app into the final application package (APK), the Android build tools use the package attribute for two things:

A
It applies this name as the namespace for your app's generated R.java class (used to access your app resources).
Example: With the above manifest, the R class is created at com.example.myapp.R.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

2nd

A
It uses this name to resolve any relative class names that are declared in the manifest file.
Example: With the above manifest, an activity declared as  is resolved to be com.example.myapp.MainActivity.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

APk

A

However, beware that, once the APK is compiled, the package attribute also represents your app’s universally unique application ID. After the build tools perform the above tasks based on the package name, they replace the package value with the value given to the applicationId property in your project’s build.gradle file (used in Android Studio projects). This final value for the package attribute must be universally unique because it is the only guaranteed way to identify your app on the system and in Google Play.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

App components

A
for each subclass of Activity.
 for each subclass of Service.
 for each subclass of BroadcastReceiver.
 for each subclass of ContentProvider.

If you subclass any of these components without declaring it in the manifest file, the system cannot start it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Intent Filters

A

App activities, services, and broadcast receivers are activated by intents. An intent is a message defined by an Intent object that describes an action to perform, including the data to be acted upon, the category of component that should perform the action, and other instructions.

When an app issues an intent to the system, the system locates an app component that can handle the intent based on intent filter declarations in each app’s manifest file. The system launches an instance of the matching component and passes the Intent object to that component. If more than one app can handle the intent, then the user can select which app to use.

An app component can have any number of intent filters (defined with the element), each one describing a different capability of that component.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Icons and Labels

A

A number of manifest elements have icon and label attributes for displaying a small icon and a text label, respectively, to users for the corresponding app component.

In every case, the icon and label that are set in a parent element become the default icon and label value for all child elements. For example, the icon and label that are set in the element are the default icon and label for each of the app’s components (such as all activities).

The icon and label that are set in a component’s are shown to the user whenever that component is presented as an option to fulfill an intent. By default, this icon is inherited from whichever icon is declared for the parent component (either the or element), but you might want to change the icon for an intent filter if it provides a unique action that you’d like to better indicate in the chooser dialog

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

User Permissions

A

Beginning with Android 6.0 (API level 23), the user can approve or reject some app permisions at runtime. But no matter which Android version your app supports, you must declare all permission requests with a element in the manifest. If the permission is granted, the app is able to use the protected features. If not, its attempts to access those features fail.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
A

The element allows you to declare hardware and software features your app needs. For example, if your app cannot achieve basic functionality on a device without a compass sensor, you can declare the compass sensor as required with the following manifest tag:

...
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
A

Each successive platform version often adds new APIs not available in the previous version. To indicate the minimum version with which your app is compatible, your manifest must include the tag and its minSdkVersion attribute.

However, beware that attributes in the element are overridden by corresponding properties in the build.gradle file. So if you’re using Android Studio, you must specify the minSdkVersion and targetSdkVersion values there instead:

android {
defaultConfig {
applicationId ‘com.example.myapp’

    // Defines the minimum API level required to run the app.
    minSdkVersion 15
    // Specifies the API level used to test the app.
    targetSdkVersion 28
...   } }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

File conventions
This section describes the conventions and rules that generally apply to all elements and attributes in the manifest file.

A

Only the and elements are required. They each must occur only once. Most of the other elements can occur zero or more times. However, some of them must be present to make the manifest file useful.

Elements at the same level are generally not ordered. For example, the , , and elements can be placed in any order. There are two key exceptions to this rule:

An element must follow the for which it is an alias.
The element must be the last element inside the element.

17
Q

elements and uses

A

Adds an action to an intent filter.
Declares an activity component.
Declares an alias for an activity.
The declaration of the application.
Adds a category name to an intent filter.
Specifies each screen configuration with which the application is compatible.
Adds a data specification to an intent filter.
Specifies the subsets of app data that the parent content provider has permission to access.
Declares an Instrumentation class that enables you to monitor an application’s interaction with the system.
Specifies the types of intents that an activity, service, or broadcast receiver can respond to.
The root element of the AndroidManifest.xml file.
A name-value pair for an item of additional, arbitrary data that can be supplied to the parent component.
Defines the path and required permissions for a specific subset of data within a content provider.
Declares a security permission that can be used to limit access to specific components or features of this or other applications.
Declares a name for a logical grouping of related permissions.
Declares the base name for a tree of permissions.
Declares a content provider component.
Declares a broadcast receiver component.
Declares a service component.
Declares a single GL texture compression format that the app supports.
Declares the screen sizes your app supports and enables screen compatibility mode for screens larger than what your app supports.
Indicates specific input features the application requires.
Declares a single hardware or software feature that is used by the application.
Specifies a shared library that the application must be linked against.
Specifies a system permission that the user must grant in order for the app to operate correctly.
Specifies that an app wants a particular permission, but only if the app is installed on a device running Android 6.0 (API level 23) or higher.
Lets you express an application’s compatibility with one or more versions of the Android platform, by means of an API level integer.