Permissions
Normal and dangerous permissions, declaring them in the manifest, asking at runtime, the rationale, repeated refusals, least privilege, and the iOS equivalent: knowing what to declare, when to ask and what to do with a refusal.
- 22 cards
- 5 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
- Scenarios
- Understand
A few cards from the deck
Normal permission: what is it?
Show the answer
A low-risk access, granted to the app at install time without asking the user anything.
INTERNETandVIBRATEare two examples: declaring them in the manifest is enough.An app declares these three permissions. Which one will also have to be requested from the user at runtime?
```xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />`RECORD_AUDIOINTERNETVIBRATE- None: the manifest is enough for all three
Show the answer
RECORD_AUDIOThe microphone gives access to private data: it is a dangerous permission. Internet and vibration are normal ones, granted at install time.
On Android, a dangerous permission is declared in the … and also requested at ….
Show the answer
On Android, a dangerous permission is declared in the manifest and also requested at runtime.
The declaration tells the system what the app might ask for; the runtime request collects the user's consent. Neither is enough alone.
Dangerous permission: what is it?
Show the answer
An access that opens private data or sensitive hardware (camera, microphone, location, contacts) and that the user must grant personally.
Since Android 6.0, it is declared in the manifest and also requested while the app runs; without a grant, the call fails.
The app crashes with "java.lang.SecurityException: "gps" location provider requires ACCESS_FINE_LOCATION permission." although the manifest does declare that permission. What is the cause?
- The manifest must declare it a second time for the network provider
- The
INTERNETpermission is missing, because location goes through the network - The phone has no GPS, so the system refuses access to location
- The permission, a dangerous one, was never requested from the user at runtime
Show the answer
The permission, a dangerous one, was never requested from the user at runtime
Declaring is not enough for a dangerous permission: without the user's grant, the location call throws. Check with
checkSelfPermission, then ask.