Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Verified Commit 3db54818 authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

Workaround for Android 8.0 NotificationChannel bug

Fixes #1312
parent 847e823d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ public class ForegroundServiceContext extends ContextWrapper {
        NotificationChannel channel = new NotificationChannel("foreground-service", "Foreground Service", NotificationManager.IMPORTANCE_NONE);
        channel.setLockscreenVisibility(Notification.VISIBILITY_SECRET);
        channel.setShowBadge(false);
        channel.setVibrationPattern(new long[0]);
        channel.setVibrationPattern(new long[] {0});
        context.getSystemService(NotificationManager.class).createNotificationChannel(channel);
        return new Notification.Builder(context, channel.getId())
                .setOngoing(true)
+0 −13
Original line number Diff line number Diff line
@@ -329,19 +329,6 @@ public class McsService extends Service implements Handler.Callback {
        return START_REDELIVER_INTENT;
    }

    @RequiresApi(api = Build.VERSION_CODES.O)
    private Notification buildForegroundNotification() {
        NotificationChannel channel = new NotificationChannel("foreground-service", "Foreground Service", NotificationManager.IMPORTANCE_LOW);
        channel.setLockscreenVisibility(Notification.VISIBILITY_SECRET);
        channel.setShowBadge(false);
        getSystemService(NotificationManager.class).createNotificationChannel(channel);
        return new Notification.Builder(this, channel.getId())
                .setOngoing(true)
                .setContentTitle("Running in background")
                .setSmallIcon(android.R.drawable.stat_notify_sync)
                .build();
    }

    private void handleSendMessage(Intent intent) {
        String messageId = intent.getStringExtra(EXTRA_MESSAGE_ID);
        String collapseKey = intent.getStringExtra(EXTRA_COLLAPSE_KEY);