From c20783116802cc961347b75d34c24f752267f436 Mon Sep 17 00:00:00 2001 From: oleg Date: Mon, 26 Feb 2018 13:55:53 +0200 Subject: [PATCH] Added check for range of importance. --- src/com/backendless/push/PushTemplateHelper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/backendless/push/PushTemplateHelper.java b/src/com/backendless/push/PushTemplateHelper.java index ee76949a5..8be30f600 100644 --- a/src/com/backendless/push/PushTemplateHelper.java +++ b/src/com/backendless/push/PushTemplateHelper.java @@ -101,8 +101,8 @@ static Notification convertFromTemplate( Context context, AndroidPushTemplate te notificationBuilder = new NotificationCompat.Builder( context.getApplicationContext() ); notificationBuilder.setDefaults( Notification.DEFAULT_ALL ); - if (template.getPriority() != null) - notificationBuilder.setPriority( template.getPriority() ); + if( template.getPriority() != null && template.getPriority() > 0 && template.getPriority() < 6 ) + notificationBuilder.setPriority( template.getPriority() - 3 ); else notificationBuilder.setPriority( Notification.PRIORITY_DEFAULT ); @@ -237,7 +237,7 @@ static private NotificationChannel updateNotificationChannel( Context context, N { notificationChannel.setShowBadge( template.getButtonTemplate().getShowBadge() ); - if (template.getPriority() != null) + if( template.getPriority() != null && template.getPriority() > 0 && template.getPriority() < 6 ) notificationChannel.setImportance( template.getPriority() ); // NotificationManager.IMPORTANCE_DEFAULT if( template.getButtonTemplate() != null && template.getButtonTemplate().getSound() != null )