UPDATE: See Volker Voecking’s answer for a better solution
EDIT: This is simply a workaround for those who don’t have time to look for a solution. *
If you get permission denied error even when the permissions are granted and you already implemented permission checks,
make sure you’re not targetting api level 29:
Change targetSdkVersion and compilesdkversion from 29 to 28 or any other lower level.