

That’s weird, it works for me on Android 15 and I could swear it was always the case for me.
A simple way to disable the sound is to press a volume button, tap the small button at the top and pick silent or vibrate there. Does that really not work for you? Btw the screenshot sound is linked to ring volume, not notifications.
The question asks for “the best” way to do it (making it opinion based) and forbids a potential solution without explaining why (it’s clearly some kind of assignment, but that doesn’t matter here). And it has plenty of answers both using Boost and in pure C++, so I’m not sure why that wasn’t enough for you. Just because it’s closed doesn’t mean the answers already provided are bad.