Home  >  Article  >  What is the use of manifest file?

What is the use of manifest file?

藏色散人
藏色散人Original
2023-03-13 14:02:538584browse

The role of the manifest file is to declare components and specify some permissions and instrumentation (security control and testing) of the app; the manifest serves as the entrance to the entire Android application, and its Manifest.xml describes the components exposed in the package. Components, their respective implementation classes, the various data that can be processed and the starting location.

What is the use of manifest file?

#The operating environment of this tutorial: Windows 10 system, Dell G3 computer.

What is the use of manifest file?

Android——The role of Manifest.xml file

Every Android APP will have an important file, that is the Manifest file in the screenshot below. This file has many functions. , is the entrance to the entire application. Next, we will explain it in detail

Overall introduction: As the entrance to the entire Android application, Manifest.xml describes the components exposed in the package. They Respective implementation classes, various data that can be processed and starting locations. In addition to the declaration of the four major components, some permissions and instrumentation (security control and testing) of the app are also specified.

1. Manifest attribute

package: Specify the package name of the java main program in the application. This is also the default for the entire application. Name

There are also some commonly used ones that can be added

android:versionCode = "1": Version number

android:versionName="first version": Version name

android:installLocation=["auto" | "internalOnly" | "preferExternal"]: Several options, namely auto automatically selects the installation location, internalOnly must be installed on the ROM, preferExternal is installed on the SD card first

2. permission attribute

uses-sdk: Here are the requirements for the minimum version of sdk

Various needs permissions need to be added to the file.

3. application attributes: declare the components of an application and its attributes (icon, label, permission, etc.)

Basically, most of them will be generated by default when generating the project, and ordinary developers do not need to take care of it.

android:allowBackup: Allow users to back up and restore corresponding data through adb backup and adb restore.

android:label: project name

android:roundIcon: Currently, new Android projects generally have two icons, one is icon (normal icon) and the other is roundIcon (round icon).

android:supportsRtl: Whether to support right-to-left layout, a newly added function in API 17

android:theme: The style of android application, yes Custom style, the above is the default style

4. Activity attribute

The simplest activity declaration is as shown in the picture above Indicates that the life of general activity will automatically add

android: launchMode, Activity loading mode, there are four types in total, as mentioned in my other article

android: multiprocess: Whether to allow multiple processes, the default is false

android: screenOrientation: display mode, the default is unspecified (automatically adjust the direction)

Here are a few commonly used ones, of course there are many, many activities Attributes, I won’t go into details one by one here

5. intent-filter attribute

This was asked this question at that time, ask What attributes does my filter have? These are the two common attributes. The interviewer said there are three. When I came back and took a look, there are really three

actions. Only the attribute android:name is the most common one. As shown in the figure, it means that this activity is the entry point of the program

category, there is only one android:name attribute, which determines whether the application is displayed in the program list

data, it is this thing, it seems that metadata can be stored here when needed in the program You can get its value. It is the following structure

Of course intent-filter itself also has some attributes

android:icon

android:label

android:priority="Integer" Ordered broadcast is performed according to the declared priority. The value range is -1000 to 1000. The larger the number, the higher the priority.

6. The other three major Components, except BroadcastReceiver which can be dynamically registered, all need to be registered in manifest.

For more related knowledge, please visit the FAQ column!

The above is the detailed content of What is the use of manifest file?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn