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

Commit 71cf2a5b authored by Nishith  Khanna's avatar Nishith Khanna
Browse files

Use background service instead of foreground service

As Etar/Calendar is a system app therefore it doesn't require to use foreground service for alerts it can use alert service as background
parent 834af66a
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -132,11 +132,7 @@ public class AlertReceiver extends BroadcastReceiver {
                mStartingService.setReferenceCounted(false);
            }
            mStartingService.acquire();
            if (Utils.isOreoOrLater()) {
                context.startForegroundService(intent);
            } else {
            context.startService(intent);
            }

        }
    }
+0 −12
Original line number Diff line number Diff line
@@ -920,18 +920,6 @@ public class AlertService extends Service {
    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        if (intent != null) {

            if (Utils.isOreoOrLater()) {

                createChannels(this);
                Notification notification = new NotificationCompat.Builder(this, FOREGROUND_CHANNEL_ID)
                        .setContentTitle("Event notifications")
                        .setSmallIcon(R.drawable.stat_notify_calendar)
                        .setShowWhen(false)
                        .build();
                startForeground(1337, notification);
            }

            Message msg = mServiceHandler.obtainMessage();
            msg.arg1 = startId;
            msg.obj = intent.getExtras();