mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
Fix #316
This commit is contained in:
parent
5398d17295
commit
a90ba05d29
@ -78,6 +78,8 @@ import javax.crypto.NoSuchPaddingException;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.app.NotificationCompat;
|
||||||
|
import androidx.core.app.NotificationManagerCompat;
|
||||||
import androidx.work.Data;
|
import androidx.work.Data;
|
||||||
import androidx.work.Worker;
|
import androidx.work.Worker;
|
||||||
import androidx.work.WorkerParameters;
|
import androidx.work.WorkerParameters;
|
||||||
@ -263,12 +265,12 @@ public class NotificationWorker extends Worker {
|
|||||||
PendingIntent pendingIntent = PendingIntent.getActivity(context,
|
PendingIntent pendingIntent = PendingIntent.getActivity(context,
|
||||||
0, intent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT);
|
0, intent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT);
|
||||||
|
|
||||||
NotificationManager notificationManager =
|
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||||
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
|
||||||
|
|
||||||
CRC32 crc32 = new CRC32();
|
CRC32 crc32 = new CRC32();
|
||||||
|
|
||||||
Notification.Builder notificationBuilder = new Notification.Builder(context)
|
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, "1")
|
||||||
.setLargeIcon(largeIcon)
|
.setLargeIcon(largeIcon)
|
||||||
.setSmallIcon(smallIcon)
|
.setSmallIcon(smallIcon)
|
||||||
.setCategory(category)
|
.setCategory(category)
|
||||||
@ -297,7 +299,7 @@ public class NotificationWorker extends Worker {
|
|||||||
.getUserId(), signatureVerification.getUserEntity().getBaseUrl());
|
.getUserId(), signatureVerification.getUserEntity().getBaseUrl());
|
||||||
crc32.update(groupName.getBytes());
|
crc32.update(groupName.getBytes());
|
||||||
|
|
||||||
NotificationUtils.createNotificationChannelGroup(notificationManager,
|
NotificationUtils.createNotificationChannelGroup(context,
|
||||||
Long.toString(crc32.getValue()),
|
Long.toString(crc32.getValue()),
|
||||||
groupName);
|
groupName);
|
||||||
|
|
||||||
|
@ -65,9 +65,12 @@ public class NotificationUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.O)
|
@TargetApi(Build.VERSION_CODES.O)
|
||||||
public static void createNotificationChannelGroup(NotificationManager notificationManager,
|
public static void createNotificationChannelGroup(Context context,
|
||||||
String groupId, CharSequence groupName) {
|
String groupId, CharSequence groupName) {
|
||||||
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 notificationManager =
|
||||||
|
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
|
||||||
NotificationChannelGroup notificationChannelGroup = new NotificationChannelGroup(groupId, groupName);
|
NotificationChannelGroup notificationChannelGroup = new NotificationChannelGroup(groupId, groupName);
|
||||||
if (!notificationManager.getNotificationChannelGroups().contains(notificationChannelGroup)) {
|
if (!notificationManager.getNotificationChannelGroups().contains(notificationChannelGroup)) {
|
||||||
notificationManager.createNotificationChannelGroup(notificationChannelGroup);
|
notificationManager.createNotificationChannelGroup(notificationChannelGroup);
|
||||||
|
Loading…
Reference in New Issue
Block a user