Книга: Beginning Android
Enforcing Permissions Elsewhere
Enforcing Permissions Elsewhere
In your code, you have two additional ways to enforce permissions.
Your services can check permissions on a per-call basis via checkCallingPermission()
. This returns PERMISSION GRANTED
or PERMISSION DENIED
, depending on whether the caller has the permission you specified. For example, if your service implements separate read and write methods, you could get the effect of readPermission
and writePermission
in code by checking those methods for the permissions you need from Java.
Also, you can include a permission when you call sendBroadcast()
. This means that eligible receivers must hold that permission; those without the permission are ineligible to receive it. For example, the Android subsystem presumably includes the RECEIVE SMS
permission when it broadcasts that an SMS message has arrived — this will restrict the receivers of that intent to be only those authorized to receive SMS messages.
- Managing Permissions
- Assigning Permissions
- Directory Permissions
- Understanding Set User ID and Set Group ID Permissions
- Changing File Access Permissions with chmod
- Managing share permissions
- Understanding the various share permissions
- Viewing and configuring share permissions
- File and folder permissions
- Understanding file and folder permissions
- Setting basic file and folder permissions
- Setting special permissions on files and folders