Recall & Review
beginner
What is the purpose of requesting permissions at runtime in Android?
To protect user privacy by asking for permission only when the app needs access to sensitive features like camera, location, or contacts.
Click to reveal answer
beginner
Which Android API level introduced runtime permission requests?
Android 6.0 (API level 23) introduced runtime permission requests.
Click to reveal answer
beginner
What method do you use to check if a permission is already granted?
Use ContextCompat.checkSelfPermission(context, permission) which returns PackageManager.PERMISSION_GRANTED or PackageManager.PERMISSION_DENIED.
Click to reveal answer
beginner
How do you request permissions from the user in an Activity?
Call ActivityCompat.requestPermissions(activity, arrayOf(permission), requestCode) to show the permission dialog.
Click to reveal answer
beginner
What callback handles the user's response to a permission request?
The onRequestPermissionsResult(requestCode, permissions, grantResults) callback receives the user's decision.
Click to reveal answer
At what point should you request a dangerous permission in Android?
✗ Incorrect
Request permissions only when the user tries to use a feature that requires it, to respect user privacy.
Which method checks if a permission is granted?
✗ Incorrect
ContextCompat.checkSelfPermission() returns whether the permission is granted or denied.
What does ActivityCompat.requestPermissions() do?
✗ Incorrect
It shows the system dialog asking the user to grant or deny the requested permissions.
Which callback receives the user's permission decision?
✗ Incorrect
onRequestPermissionsResult() is called with the user's response to the permission request.
If a user denies a permission, what should your app do?
✗ Incorrect
You should politely explain why the permission is needed and ask again if appropriate.
Describe the steps to request a dangerous permission at runtime in an Android app.
Think about checking first, then asking, then reacting.
You got /3 concepts.
Explain why Android requires runtime permission requests instead of asking all permissions at install time.
Consider how users feel about privacy and control.
You got /3 concepts.