Check Permissions In KOTLIN (RunTime)
In Manifest: (android.permission.WRITE_EXTERNAL_STORAGE)
fun checkPermissions(){
var permission_array=arrayOf(android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
if((ContextCompat.checkSelfPermission(this,permission_array[0]))==PackageManager.PERMI SSION_DENIED){
requestPermissions(permission_array,0)
}
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if(requestCode==0 && grantResults[0]==PackageManager.PERMISSION_GRANTED){
//Do Your Operations Here
---------->
//
}
}