0

I am searching everywhere for this and the closest thing to an answer i got was this which could not block the heads-up notifications.

I am creating a custom screen record app and it annoyies me when heads up notifications show up in my app while recording.

Is there any way i can hide or disable every incoming notification while the screen is recording ?!

I would appreciate if you can give me an example that works on a non rooted device.

Vishal Yadav
  • 3,642
  • 3
  • 25
  • 42
areyouSEARious
  • 117
  • 1
  • 13

1 Answers1

3

Seems you can clear notifications through the NotificationManager as they come.

In API 23+ you can use both NotificationManager#setNotificationPolicy() and NotificationManager#setInterruptionFilter() (in that specific order) to control which notifications are shown to the user. Permissions are required for those APIs. Notice that this methods seem to be a convenience to be able to access the functionality, but skip implementing a complete NotificationListenerService. That's the only option that can work in a satisfying way

Details: How do some apps block/replace heads-up notifications?

Mars
  • 2,505
  • 17
  • 26
  • Thank you for your answer. I have been trying all the given solutions but the heads-up notifications are not blocked or hidden, just the notifications are deleted which is not much of a help for me. – areyouSEARious Oct 18 '17 at 06:57
  • A little more detail, not sure if it helps. Other than this, the general answer seems to be no--there do seem to be some work-around methods with inconsistent results though. – Mars Oct 18 '17 at 07:02
  • 1
    There are some apps like HeadsOff (https://play.google.com/store/apps/details?id=com.jamworks.noheadsup&hl=de) but according to the reviews it is not consistent throughout devices. Anyways, thank you for your help, i appreciate it. – areyouSEARious Oct 18 '17 at 07:12
  • The last option (quoted) still seems promising though, maybe worth a try – Mars Oct 18 '17 at 07:15