-6

i want to disable notifications coming from other apps like Facebook and other apps.

I know it is possible because the Notifications Off app has this functionality.

Dennis Meng
  • 5,109
  • 14
  • 33
  • 36
Babar Sanah
  • 533
  • 1
  • 7
  • 13

2 Answers2

5

Actually, you could achieve this (for API level 18+) with the new NotificationListenerService and the appropriate permissions.

You can use getActiveNotifications() to get the list of current notifications in the device, and then cancelNotification() to close them individually or cancelAllNotifications() to remove them all at once.

So you could be notified (heh) as soon as a notification arrives, then dismiss it if it's from one of these "blocked" applications.

matiash
  • 54,791
  • 16
  • 125
  • 154
0

You can't, unless you have root or your code runs with system/phone app process id. The app you linked to in your question requires root.

In case you have root and are not afraid to use reflection to access hidden methods, you can examine how App Settings enables/disables notifications for a package.

laalto
  • 150,114
  • 66
  • 286
  • 303