Hi!
I am making an app that needs to set the ringer mode to silent, when i run the AudioComponent.Ringer Mode Silent block an error occurs:
“Not allowed to change Do Not Disturb State”, both in companion and in apk.
I granted all the required permissions but still doesn’t work.
I’ve also tried to grant Access to Do not disturb state from the phone’s settings but i haven’t found my app in the list.
Tested with two phones: Samsung J7 pro and Samsung S8+, both with android 9
Here is an example file i’ve made, the errors are the same as in my original app.
When i ask for permission android.permission.ACCESS_NOTIFICATION_POLICY this error is shown in companion: Attempt to invoke virtual method 'void android.media.AudioManager.setRingerMode(int)' on a null object reference