Ad

How Do I Make An Android Local Notification That Doesn't Pop-up, Just Shows Up On The Notification List?

- 1 answer

I am making a type of alarm app. I have a special alarm screen that I show when the alarm time comes. That works fine. But I also want there to be an entry in the notifications list if the user snoozes the alarm. But when I try to use a regular Notification using NotificationBuilder, it pops up on the screen at the same as my alarm activity (which is not full screen - uses transparency). There must be a way to get the notification into the list, so the user will see it there, but not have it pop up at alarm time.

Ad

Answer

You need to use a low priority for channel you created

NotificationManager.IMPORTANCE_LOW  or NotificationManager.IMPORTANCE_MIN 

From Android Oreo, you need to use notification channels for creating Notifications.

For Example : When you create a channel, with id "Alerts" , you can define its properties like, its importance , sound etc...

The various Importance Attributes used are as follows:

IMPORTANCE_DEFAULT: Default notification importance: shows everywhere, makes noise, but does not visually intrude. Constant Value: 3

IMPORTANCE_HIGH : Higher notification importance: shows everywhere, makes noise and peeks. May use full screen intents.

[This will keep showing over other apps and again like whatsapp message notification] This works so because of its importance. Constant Value: 4

IMPORTANCE_LOW Low notification importance: shows everywhere, but is not intrusive. Constant Value: 2

IMPORTANCE_MIN Min notification importance: only shows in the shade, below the fold. Constant Value: 1

So once you define a channels properties it could be changed by only the user through notification intent. Which i mentioned here : https://stackoverflow.com/a/54199316/7039593

Using a low priority / min min importance may solve your problem

Ad
source: stackoverflow.com
Ad