0
0
Android Kotlinmobile~5 mins

Permission request flow in Android Kotlin - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AWhen the app is installed
BNever
CBefore the app launches
DWhen the user tries to use a feature that needs the permission
Which method checks if a permission is granted?
AcheckPermissionGranted()
BrequestPermissions()
CContextCompat.checkSelfPermission()
DonRequestPermissionsResult()
What does ActivityCompat.requestPermissions() do?
AShows a dialog to ask the user for permission
BChecks if permission is granted
CRevokes a permission
DStarts a new activity
Which callback receives the user's permission decision?
AonRequestPermissionsResult()
BonPermissionResult()
ConPermissionGranted()
DonUserResponse()
If a user denies a permission, what should your app do?
ACrash immediately
BExplain why the permission is needed and offer to request again
CKeep requesting permission repeatedly without explanation
DIgnore the permission and continue as if granted
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.