Sub SetDoNotDisturb (Policy As Int)
Dim NotificationManager As JavaObject
NotificationManager = NotificationManager.InitializeContext.RunMethod("getSystemService", _
Array("notification"))
If NotificationManager.RunMethod("isNotificationPolicyAccessGranted", Null) = False Then
Dim in As Intent
in.Initialize("android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS", "")
StartActivity(in)
Wait For Activity_Resume '<---
Log("after resume")
End If
If NotificationManager.RunMethod("isNotificationPolicyAccessGranted", Null) = True Then
NotificationManager.RunMethod("setInterruptionFilter", Array(Policy))
Else
Log("No permission!")
End If
End Sub