Adjust notification channel importances
This commit is contained in:
@@ -24,16 +24,20 @@ public class NotificationSupport {
|
|||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
public static void createChannels(NotificationManager notificationManager) {
|
public static void createChannels(NotificationManager notificationManager) {
|
||||||
try {
|
try {
|
||||||
|
// Low importance so that persistent notification can be sorted towards bottom of
|
||||||
|
// notification shade. Also prevents vibrations caused by persistent notification
|
||||||
NotificationChannel foreground =
|
NotificationChannel foreground =
|
||||||
new NotificationChannel(
|
new NotificationChannel(
|
||||||
Channel.FOREGROUND,
|
Channel.FOREGROUND,
|
||||||
"Gotify foreground notification",
|
"Gotify foreground notification",
|
||||||
NotificationManager.IMPORTANCE_DEFAULT);
|
NotificationManager.IMPORTANCE_LOW);
|
||||||
|
// High importance for message notifications so that they are shown as heads-up
|
||||||
|
// notifications and sorted towards the top of the notification shade
|
||||||
NotificationChannel messages =
|
NotificationChannel messages =
|
||||||
new NotificationChannel(
|
new NotificationChannel(
|
||||||
Channel.MESSAGES,
|
Channel.MESSAGES,
|
||||||
"Gotify messages",
|
"Gotify messages",
|
||||||
NotificationManager.IMPORTANCE_DEFAULT);
|
NotificationManager.IMPORTANCE_HIGH);
|
||||||
notificationManager.createNotificationChannel(foreground);
|
notificationManager.createNotificationChannel(foreground);
|
||||||
notificationManager.createNotificationChannel(messages);
|
notificationManager.createNotificationChannel(messages);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user