Is there a way to show action buttons in notification expanded by default? I use ongoing notification to control traning process in my app. I want controling buttons such as "Stop" and "Pause" to be visible right after notification appeared in the notification area.
Show android notification action buttons expanded by default
Please go through to https://mcmap.net/q/361927/-is-possible-set-expanded-notification-as-default-in-big-text-notifications –
Alsatian
@LakshayJuneja thanks for quick reply. But I do not use BigTextStyle, I just want my action buttons was visible. Do those rules apply for buttons as well? –
Branscum
@ Oleksandr Albul... yes because you can only set priority to your notifications as setPriority(NotificationCompat.PRIORITY_HIGH) or any other. To show notification as you expected is OS dependent. –
Alsatian
@LakshayJuneja I've already done setPriority(NotificationCompat.PRIORITY_HIGH), but notification appears in the top and still has buttons collapsed. –
Branscum
sorry for the such delay, as I have already mentioned above you couldn't force OS to show notification as expanded. –
Alsatian
You can't expand notification. The only solution is, set Priority Max, then the top of the notification list where it would be expanded. And it depends on the device as well.
mBuilder.setPriority(Notification.PRIORITY_HIGH)
It seems accepted answer for this moment. And the only way to show buttons without expanding is to implement your custom layout for the notification. –
Branscum
I wanted inverse. I wanted to collapse notification by default so I changed it to
NotificationManager.IMPORTANCE_MIN
and It worked. –
Delois priority didn't work for Samsung S10, still collapsed by default, only for Pixel 4 –
Jarboe
Make sure you also set the priority for any NotificationChannel you create! –
Nakamura
I am working on project . There is same requirement come . I searched online . And i found a solution , i just add few line in my notification it work.
notification.priority = NotificationCompat.PRIORITY_MAX
notification.setStyle(NotificationCompat.BigTextStyle())
© 2022 - 2024 — McMap. All rights reserved.