I have rewritten the code. This time I did not use try and catch any error, but instead I checked which device version the app was running so that It can ask for permission.
This is the debug APK of the app version I wrote, You can test it on API less that 28, which it will ask for permission of course.
And anything higher than than 28 it will not ask for permission
note it is only API lower than 28 that ask for write permission
I have rewritten the code. This time I did not use try and catch any error, but instead I checked which device version the app was running so that It can ask for permission.
This is the debug APK of the app version I wrote, You can test it on API less that 28, which it will ask for permission of course. And anything higher than than 28 it will not ask for permission
note it is only API lower than 28 that ask for write permission
debug.zip