1

Hello I'm using this code to ask for permission to read and write but the permission request does not appear, does anyone know how to fix this?

in oncreate

code

 setupPermissions()
        setupPermissions2()

after oncreate

-

private fun setupPermissions() {
    val permission = ContextCompat.checkSelfPermission(context!!,
            Manifest.permission.READ_EXTERNAL_STORAGE)

    if (permission != PackageManager.PERMISSION_GRANTED) {
        Log.i(TAG, "Permission to record denied")
    }
}
private fun setupPermissions2() {
    val permission = ContextCompat.checkSelfPermission(context!!,
            Manifest.permission.WRITE_EXTERNAL_STORAGE)

    if (permission != PackageManager.PERMISSION_GRANTED) {
        Log.i(TAG, "Permission to record denied")
    }
}
YPLABS
  • 484
  • 3
  • 11
  • 1
    You're only checking if permission is already granted. To actually request permissions see https://stackoverflow.com/a/34722591/9241978 – Pawel Feb 08 '20 at 20:27

0 Answers0