Skip to content

Commit

Permalink
Ensure notifications can show on the top of old devices' home screen
Browse files Browse the repository at this point in the history
> On platforms O and above this value is ignored in favor of the values set on the notification's channel. On older platforms, this value is still used, so it is still required for apps supporting those platforms.

See https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setDefaults(int).
  • Loading branch information
Goooler committed Mar 31, 2024
1 parent e2d0daa commit 9a265c5
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ class NotificationHelper @Inject constructor(@ApplicationContext context: Contex
// notification.
.setStyle(messagingStyle)
.setWhen(messages.last().timestamp)
// Compat older APIs without notification channels for ensuring
// message notifications can show on the top of home screen.
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setDefaults(Notification.DEFAULT_ALL)
// Don't sound/vibrate if an update to an existing notification.
if (update) {
builder.setOnlyAlertOnce(true)
Expand Down

0 comments on commit 9a265c5

Please sign in to comment.