Is it possible to move a notification from heads-up to the status bar?
Asked Answered
M

1

6

Background

Android Lollipop (API 21) introduced a way to show notifications outside of the status bar (AKA "notifications bar"), so that the user can handle them right away. It's called "Heads-up notifications".

The trigger for showing them may vary between devices/roms/manufacturers.

The problem

Sometimes, showing such notifications can annoy users, and most of the times there are no settings for those cases.

If the user dismisses heads-up notifications, they won't show as a normal notification. There is no way to hide them and continue with what's on the screen. You can only wait (and it's quite a long time of waiting too).

In fact, there are multiple Google-Group issues that were opened about it, just because it can annoy people (link here and here).

What I've found

Starting with API 18, it is possible to listen to notifications events and even read them, by using "NotificationListenerService" and "StatusBarNotification" , and maybe other classes.

However, other than dismissing notifications (of other apps), I can't find any other action that can be done to them.

The question

Is it possible that in the lifetime of my app, I will be able to listen to notifications that are shown as heads-up, and put them back as a status-bar notifications?

Maybe even set a different timeout for them? or choose to convert them to normal status-bar notifications when they get dismissed?

Maybe before even doing those operations, I should ask: how can I know if a notification that I've found (of other apps) is showing as a heads-up notification ?

Mcdevitt answered 23/1, 2015 at 8:49 Comment(1)
it depends on its priority: if the priority is high or max and you set vibrate to the notification - it will "heads up"Haitian
C
0

I don't know how to do implement this. But answering the "Is it possible that...?" question, yes, there are apps like this one that block/only show notifications in the notification bar.

Cynical answered 8/7, 2015 at 15:36 Comment(6)
I think you meant this one: play.google.com/store/apps/… . Wonder how they all work.Mcdevitt
It seems both have the same purpose. And yes, wonder how they work. They need full access to the device's notifications, I actually had to enable its permission on Settings -> Notification Manager -> Notification access (on Android 5.0).Cynical
Please let me know if you find out. Maybe they draw a fake one of their own, and dismiss the normal notifications as they come.Mcdevitt
HeadsOff definitely draws over the heads-up notification that's received. You can tell because normal heads-up notifications shows over the status bar and u can still see the status bar items behind it. But for HeadsOff, the status bar is just a blank bar.Foeman
HeadsOff doesn't seem to work on Marshmellow even with the draw over. You can view the view layout bounds with "Show layout bounds" in the developer debug settings but the heads up notification sits on top of their system alert.Provost
@Provost On Marshmellow you can disable these notifications natively, on Settings -> Notifications -> Heads up -> turn it offCynical

© 2022 - 2024 — McMap. All rights reserved.