mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
Fix notification channel creation
This commit is contained in:
parent
a90ba05d29
commit
65d9296209
@ -304,7 +304,7 @@ public class NotificationWorker extends Worker {
|
|||||||
groupName);
|
groupName);
|
||||||
|
|
||||||
if (decryptedPushMessage.getType().equals("chat")) {
|
if (decryptedPushMessage.getType().equals("chat")) {
|
||||||
NotificationUtils.createNotificationChannel(notificationManager,
|
NotificationUtils.createNotificationChannel(context,
|
||||||
NotificationUtils.NOTIFICATION_CHANNEL_MESSAGES_V3, context.getResources()
|
NotificationUtils.NOTIFICATION_CHANNEL_MESSAGES_V3, context.getResources()
|
||||||
.getString(R.string.nc_notification_channel_messages), context.getResources()
|
.getString(R.string.nc_notification_channel_messages), context.getResources()
|
||||||
.getString(R.string.nc_notification_channel_messages), true,
|
.getString(R.string.nc_notification_channel_messages), true,
|
||||||
@ -312,7 +312,7 @@ public class NotificationWorker extends Worker {
|
|||||||
|
|
||||||
notificationBuilder.setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_MESSAGES_V3);
|
notificationBuilder.setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_MESSAGES_V3);
|
||||||
} else {
|
} else {
|
||||||
NotificationUtils.createNotificationChannel(notificationManager,
|
NotificationUtils.createNotificationChannel(context,
|
||||||
NotificationUtils.NOTIFICATION_CHANNEL_CALLS_V3, context.getResources()
|
NotificationUtils.NOTIFICATION_CHANNEL_CALLS_V3, context.getResources()
|
||||||
.getString(R.string.nc_notification_channel_calls), context.getResources()
|
.getString(R.string.nc_notification_channel_calls), context.getResources()
|
||||||
.getString(R.string.nc_notification_channel_calls_description), true,
|
.getString(R.string.nc_notification_channel_calls_description), true,
|
||||||
|
@ -44,11 +44,14 @@ public class NotificationUtils {
|
|||||||
public static final String NOTIFICATION_CHANNEL_CALLS_V3 = "NOTIFICATION_CHANNEL_CALLS_V3";
|
public static final String NOTIFICATION_CHANNEL_CALLS_V3 = "NOTIFICATION_CHANNEL_CALLS_V3";
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.O)
|
@TargetApi(Build.VERSION_CODES.O)
|
||||||
public static void createNotificationChannel(NotificationManager notificationManager,
|
public static void createNotificationChannel(Context context,
|
||||||
String channelId, String channelName,
|
String channelId, String channelName,
|
||||||
String channelDescription, boolean enableLights,
|
String channelDescription, boolean enableLights,
|
||||||
int importance) {
|
int importance) {
|
||||||
|
|
||||||
|
NotificationManager notificationManager =
|
||||||
|
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O
|
||||||
&& notificationManager.getNotificationChannel(channelId) == null) {
|
&& notificationManager.getNotificationChannel(channelId) == null) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user