【正文】
, such as a camera, a light sensor, bluetooth, a certain version of OpenGL, or the fidelity of the touchscreen. You should never assume that a certain feature is available on all Androidpowered devices (other than the availability of the standard Android library), so you should declare any features used by your application with thedocument.Input configurationsMany devices provide a different type of user input mechanism, such as a hardware keyboard, a trackball, or a fiveway navigation pad. If your application requires a particular kind of input hardware, then you should declare it in your manifest with theelement.For more information, see theit. In that case, your application must perform a check at runtime to determine if the device has a camera and disable any features that use the camera if one is not available. Here are some of the important device characteristics that you should consider as you design and develop your application:Screen size and densityIn order to categorize devices by their screen type, Android defines two characteristics for each device: screen size (the physical dimensions of the screen) and screen density (the physical density of the pixels on the screen, or dpi—dots per inch). To simplify all the different types of screen configurations, the Android system generalizes them into select groups that make them easier to target.The screen sizes are: small, normal, large, and extra large.The screen densities are: low density, medium density, high density, and extra high density.By default, your application is patible with all screen sizes and densities, because the Android system makes the appropriate adjustments to your UI layout and image resources. However, you should create specialized layouts for certain screen sizes and provide specialized images for certain densities, using alternative layout resources, and by declaring in your manifest exactly which screen sizes your application supports with thethan cannot install your application from Google Play. However, you can also declare that your application uses the camera, but does nothave a camera and have an Android version7), you should declare these as requirements in your manifest file. That way, devices that dodocument.Declaring application requirements There are a variety of devices powered by Android and not all of them provide the same features and capabilities. In order to prevent your application from being installed on devices that lack features needed by your application, it39。startActivity(). For more about creating intent filters, see theelement as a child of the ponent39。s manifest, you can optionally include intent filters that declare the capabilities of the ponent so it can respond to intents from other applications. You can declare an intent filter for your ponent by adding anintent filtersIntentregisterReceiver().Declaring ponent capabilities As discussed above, inBroadcastReceiverelements for broadcast receiversl providerelements for activitiesl serviceandroid:labelActivityandroid:nameactivityandroid:iconapplication activity android:name= application android:icon=drawable/ ... s ponents. For example, a manifest file can declare an activity as follows:?xml version= encoding=utf8?manifest ... andServices,document. More information about activating specific ponents is also provided in the following documents:ContentResolver. For more information about using intents, see thequery()sendStickyBroadcast().sendBroadcast(),IntenttobindService().startService(). Or you can bind to the service by passing anIntent(when you want the activity to return a result).orto You can start an activity (or give it something new to do) by passing anContentResolvers performing transactions with the provider doesn39。(for example, you can issue an intent to let the user pick a personal contact and have it returned to you—the return intent includes a URI pointing to the chosen contact). For broadcast receivers, the intent simply defines the announcement being broadcast (for example, a broadcast to indicate the device battery is low includes only a known action string that indicates battery is low). The other ponent type, content provider, is not activated by intents. Rather, it is activated when targeted by a request from aof ponent—an intent can be either explicit or implicit, respectively. For activities and services, an intent defines the action to perform (for example, to view or send something) and may specify the URI of the data to act on (among other things that the ponent being started might need to know). For example, an intent might convey a request for an activity to show an image or to open a web page. In some cases, you can start an activity to receive a result, in which case, the activity also returns the result in anobject, which defines a message to activate either a specific ponent or a specificintent. Intents bind individual ponents to each other at runtime (you can think of them as the messengers that request an action from other ponents), whether the ponent belongs to your application or another. An intent is created with anintentmain()t have a single entry point (there39。s not already running) and instantiates the classes needed for the ponent. For example, if your application starts the activity in the camera application that captures a photo, that activity runs in the process that belongs to the camera application, not in your application39。s probably another application that does that and your application can use it, instead of developing an activity to capture a photo yourself. You don39。object. For more information, see theBroadcastReceiverand each broadcast is delivered as anto alert the user when a broadcast event occurs. More monly, though, a broadcast receiver is just a gateway to other ponents and is intended to do a very minimal amount