I would like to submit an app to the Play Store, but I am a tad bit confused as far as permissions are concerned.
Basically, the app would need permission for the users to either take pictures (Camera usage) or upload from their gallery (I believe that is the Manifest.permission.READ_EXTERNAL_STORAGE
? I don’t know if that is the correct term for accessing their gallery and such.
Do I just declare something like this in the AndroidManifest
file? And is that all it would take, please? Or it should be declared elsewhere, and how if so, please?
<manifest ...>
<uses-permission android:name="android.permission.CAMERA"/>
<application ...>
...
</application>
</manifest>
You will have to add both Camera and External Storage permission like this in AndroidManifest.xml
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
And the following way to check runtime permissions in code
val requestMultiplePermissions = registerForActivityResult(
ActivityResultContracts.RequestMultiplePermissions()
) { permissions ->
permissions.entries.forEach {
Log.d("DEBUG", "${it.key} = ${it.value}")
}
}
requestMultiplePermissions.launch(
arrayOf(
Manifest.permission.CAMERA,
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
)