Android-Application Androidmanifest Application node Introduction

Source: Internet
Author: User
Tags event listener

A manifest can contain only one application node. He uses various attributes to specify the various metadata for the application (including title, Icon, and theme), and when developing the application, it should be a debuggable property with true to enable debugging, but you can disable the property at publish time

The Application node can also act as a container for activity, Service, Content provider, and broadcast receiver and yes, which contains the nodes that specify the application components.

<application android:icon= "@drawable/icon"

android:logo= "@drawable/logo"

Android:theme= "@android: Style/theme.notitlebar.fullscreen"

Android:name= ". Myapplicationactivity "

Android:debuggable= "true" >

</application>

  1) each activity in the activity application requires an activity tag and uses the Android:name property to specify the name of the activity class. Must contain the core startup activity and all other activity that can be displayed. Launching any activity that is not defined in manifest throws a run-time exception. Each activity node allows the use of intent-filter to define the intent used to initiate the activity.

You can use the "." In the English state when specifying the class name of the activity. Replaces the application's package name as a shorthand.

<activity android:name= ". Myactivityname "

Android:label= "@string/app_name" >

<intent-filter>

<action android:name= "Android.intent.action.MAIN"/>

<category android:name= "Android.intent.category.LAUNCHER"/>

</intent-filter>

</activity>

  2) as with the service and activity tags, you need to add a label for each service class used in the application. Service transitions also support the use of Intent-filter to allow runtime bindings.

<service android:name= ". Myserviceclass "></service>

  3) The Provider Provider tag is used to specify each content Provider in the application. Content provider is used to manage database access and sharing.

<provider android:name= ". Mycontentprovider "

android:authorities= "Com.package.myapp.MyContentprovider"/>

  4) receiver by adding the receiver tag, you can register a broadcast receiver without having to start the application in advance. Broadcast receiver like a global event listener, once registered, whenever the intent that matches it is broadcast by the system or application, it executes immediately. By registering a broadcast Receiver in the manifest, the process can be fully autonomous. If a matching intent is broadcast, the application will start automatically and your registered broadcast receiver will start running. Each receiver node allows the use of intent-filter to define the intent that can be used to trigger the receiver

<receiver android:name= ". Myintentreceiver ">

<intent-filter>

<action android:name= "Com.package.mybroadcastaction"/>

</intent-filter>

</receiver>

  5) User-library is used to specify the shared libraries required by the application. For example, to package the map API as a separate library, it will not be automatically linked. You can specify whether a particular package is required or optional. When specified as required, the application cannot be installed on a device that is missing a specified library, and when specified as optional, the application must use a reflection mechanism to check for the existence of the cry before the view uses the library.

<users-library android:name= "Com.google.android.maps"

Android:required-"false"/>

More Androidmanifest Configuration Reference address: http://developer.android.com/guide/topics/manifest/manifest-intro.html (requires FQ)

Android-Application Androidmanifest Application node Introduction

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.