Setting Do Not Disturb mode

Does anyone know how I can allow the user to set Do Not Disturb (DND) mode (temporarily, while using my app)? I am building an educational app, and I would like very much to help the user to set their mobiles easily to DND mode to remove distractions. Of course, it should ask them for permission, and get them to set it (allowing them to keep emergency notifications enabled), and all of this while they are still inside my app.

Currently the only solution that I see if to give them instructions on how to do this, and send them out of my app. However, if anyone knows of a service that can allow me to do this better, please let me know.

Thanks!

Android:

NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        mNotificationManager.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_NONE);

Need this:

<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />

Hi @tony.ycy.program , thank you for the reply!
Please could you expand a bit? How do I embed this code in Thunkable?

May need to ask @domhnallohanlon to add components
This is a closed platform, and most people can’t do anything about it !