0
0
Android Kotlinmobile~5 mins

Camera access in Android Kotlin - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What permission is required to access the camera on Android?
The android.permission.CAMERA permission must be declared in the AndroidManifest.xml file and requested at runtime for Android 6.0 and above.
Click to reveal answer
beginner
How do you launch the camera app to take a photo using an Intent in Kotlin?
Use an Intent with action MediaStore.ACTION_IMAGE_CAPTURE and start it with startActivityForResult or the modern registerForActivityResult API.
Click to reveal answer
intermediate
What is the purpose of registerForActivityResult in camera access?
It replaces startActivityForResult to handle the result of the camera app in a cleaner, lifecycle-aware way.
Click to reveal answer
intermediate
Why do you need to create a file URI before launching the camera Intent?
To save the captured photo, you provide a file URI where the camera app stores the image. This avoids getting only a thumbnail and allows full-size photo saving.
Click to reveal answer
advanced
What is the role of FileProvider in camera access?
FileProvider securely shares file URIs with other apps, like the camera app, avoiding exposing file paths directly.
Click to reveal answer
Which permission must be requested at runtime to use the camera on Android 6.0+?
Aandroid.permission.CAMERA
Bandroid.permission.INTERNET
Candroid.permission.ACCESS_FINE_LOCATION
Dandroid.permission.READ_CONTACTS
What Intent action is used to open the camera app for capturing a photo?
AIntent.ACTION_SEND
BIntent.ACTION_VIEW
CMediaStore.ACTION_IMAGE_CAPTURE
DMediaStore.ACTION_VIDEO_CAPTURE
Which API is recommended for receiving results from the camera Intent in modern Android development?
AstartActivityForResult
BonActivityResult
CstartService
DregisterForActivityResult
Why is FileProvider used when sharing a photo file URI with the camera app?
ATo compress the image
BTo securely share file URIs without exposing file paths
CTo encrypt the photo
DTo upload the photo to cloud
What happens if you do not provide a file URI when launching the camera Intent?
AYou get only a small thumbnail image
BThe camera app records video instead
CThe photo is saved automatically in gallery
DThe camera app crashes
Explain the steps to capture a photo using the camera in an Android app with Kotlin.
Think about permissions, file storage, Intent, and result handling.
You got /5 concepts.
    Describe why FileProvider is important when working with camera photo files on Android.
    Consider Android's file access security model.
    You got /4 concepts.