Download Teach Yourself Android Application Development in 24

Transcript
Managing Application Permissions
ANDROID PLATFORM SECURITY MODEL
Android Application #1
“DroidWars”
com.androidbook.DroidWars
Android Application #2
“Chippy’s Revenge!”
com.androidbook.Chipmunk
DALVIK Virtual Machine
DALVIK Virtual Machine
Linux User
“com.androidbook.DroidWars”
Linux User
“com.androidbook.Chipmunk”
Private
App Files and
Databases
Private
App Files and
Databases
89
FIGURE 5.6
Simplified
Android platform
architecture
from a security
perspective.
Linux Operating System
Android Platform Security Enforcement
Access Shared Data
Contacts, Calendars, Owner Information,
Phone Data, etc.
Access Handset Hardware
Phone Dialer, WiFi, Bluetooth, Camera, Audio,
Telephony, Device Sensors, etc.
Try It Yourself
▼
To give your application permission to access the built-in camera, use the following
steps:
1. Open the Droid1 project in Eclipse.
2. Open the Android manifest file and click the Permissions tab of the resource
editor.
3. Click the Add button and choose Uses Permission. The Name attribute for the
permission is shown in the right side of the screen as a drop-down list.
4. Choose android.permission.CAMERA from the drop-down list.
5. Save the manifest file. Switch to the AndroidManifest.xml tab to see what the
new XML looks like.
You have now registered the camera permission. Your application will be able to
access the camera without security exceptions.
▲