Книга: Beginning Android
Mother, May I?
Mother, May I?
Requesting the use of other applications’ data or services requires the uses-permission
element to be added to your AndroidManifest.xml
file. Your manifest may have zero or more uses-permission elements, all as direct children of the root manifest
element.
The uses-permission
element takes a single attribute, android:name
, which is the name of the permission your application requires:
<uses-permission
android:name="android.permission.ACCESS LOCATION" />
The stock system permissions all begin with android.permission
and are listed in the Android SDK documentation for Manifest.permission
. Third-party applications may have their own permissions, which hopefully they have documented for you. Here are some of the more important built-in permissions:
• INTERNET
, if your application wishes to access the Internet through any means, from raw Java sockets through the WebView
widget
• READ CALENDAR
, READ CONTACTS
, and the like for reading data out of the built-in content providers
• WRITE CALENDAR
, WRITE CONTACTS
, and the like for modifying data in the built-in content providers
Permissions are confirmed at the time the application is installed — the user will be prompted to confirm it is OK for your application to do what the permission calls for. This prompt is not available in the current emulator, however.
If you do not have the desired permission and you try to do something that needs it, you may get a SecurityException
informing you of the missing permission, but this is not a guarantee — failures may come in other forms, depending on if something else is catching and trying to handle that exception.
- 1.11.1 Problems You May Encounter
- May I See Your Documents?
- 2.7.5 Problems You May Encounter
- 3.4.3 Problems You May Encounter
- 5.5.3 Problems You May Encounter
- 7.6.4 Problems You May Encounter
- 2. Правило MAYA
- Глава 2 Табличный редактор Microsoft Excel
- 16.13 Формат сообщений MIME
- Build a Run-Time Image for an OS Design
- Клонирование по сетке ("Copy to Grid")
- Программирование для Linux. Профессиональный подход