Java Reference
In-Depth Information
<data android:mimeType="image/jpeg" />
<category
an-
droid:name="android.intent.category.default" />
</intent-filter>
</activity>
SimpleActivity2
's
intent-filter
element helps Android determine that
thisactivityistobelaunchedwhenthe
Intent
object'svaluesmatchthefollowingtag
attribute values:
•
<action>
's
attribute
is
assigned
name
"an-
droid.intent.action.view"
.
•
<data>
's
mimeType
attribute is assigned the
"image/jpeg"
MIME type.
•
<category>
's
name
attribute is assigned
"an-
droid.intent.category.default"
to allow the activity to be
launched without explicitly specifying its component.
Note
The
data
element describes the data on which an intent operates. Its
mimeType
attributeidentifiesthedata'sMIMEtype.Additionalattributescanbespe-
cified. For example, you could specify
path
to identify the data's location URI.
AndroidManifest.xml
maycontainadditionalinformation,suchasnamingany
librariesthattheappneedstobelinkedagainst(besidesthedefaultAndroidlibrary),and
identifying all app-enforced permissions (via
permission
elements) to other apps,
such as controlling who can start the app's activities.
Also, the manifest may contain
uses-permission
elements to identify permis-
sions that the app needs. For example, an app that needs to use the camera would
specify the following element:
<uses-permission
an-
droid:name="android.permission.camera" />
.
Note
uses-permission
elementsarenestedwithin
manifest
elements—they
appear at the same level as the
application
element.
Atappinstalltime,permissionsrequestedbytheapp(via
uses-permission
)are
granted to it by Android's package installer, based on checks against the digital signa-
tures of the apps declaring those permissions and/or interaction with the user.
No checks with the user are done while an app is running. It was granted a specific
permissionwheninstalledandcanusethatfeatureasdesired,orthepermissionwasn't
granted and any attempt to use the feature will fail without prompting the user.