Книга: Beginning Android

Permissions, Instrumentations, and Applications (Oh, My!)

Permissions, Instrumentations, and Applications (Oh, My!)

Underneath the manifest element, you will find the following:

• uses-permission elements to indicate what permissions your application will need in order to function properly. See Chapter 29 for more details.

• permission elements to declare permissions that activities or services might require other applications hold in order to use your application’s data or logic. Again, more details are forthcoming in Chapter 29.

• instrumentation elements to indicate code that should be invoked on key system events, such as starting up activities, for the purposes of logging or monitoring.

uses-library elements to hook in optional Android components, such as mapping services

• Possibly a uses-sdk element to indicate what version of the Android SDK the application was built for.

• An application element defining the guts of the application that the manifest describes.

In the following example the manifest has uses-permission elements to indicate some device capabilities the application will need — in this case, permissions to allow the application to determine its current location. And there is the application element, whose contents will describe the activities, services, and whatnot that make up the bulk of the application itself.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="com.commonsware.android">
 <uses-permission
  android:name="android.permission.ACCESS_LOCATION" />
 <uses-permission
  android:name="android.permission.ACCESS_GPS" />
 <uses-permission
  android:name="android.permission.ACCESS_ASSISTED_GPS" />
 <uses-permission
  android:name="android.permission.ACCESS_CELL_ID" />
 <application>
  ...
 </application>
</manifest>

Оглавление книги


Генерация: 1.342. Запросов К БД/Cache: 3 / 1
поделиться
Вверх Вниз