From 13f2b47640749031241849da312b2b2d0699ebe8 Mon Sep 17 00:00:00 2001 From: hajoha Date: Mon, 13 Jan 2025 15:01:36 +0100 Subject: [PATCH] fix bug, remove Cell Notification when disabled --- .../OpenMobileNetworkToolkit/NotificationService.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/NotificationService.java b/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/NotificationService.java index 894e3f30..9349f7c8 100644 --- a/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/NotificationService.java +++ b/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/NotificationService.java @@ -53,9 +53,6 @@ private void setupNotificationUpdate() { private void stopNotificationUpdate() { Log.d(TAG, "stopNotificationUpdate"); notificationHandler.removeCallbacks(servingCellNotificaiton); - //builder.setContentText(null); - //nm.notify(1, builder.build()); - nm.cancel(4); if (notificationHandlerThread != null) { notificationHandlerThread.quitSafely(); @@ -66,6 +63,12 @@ private void stopNotificationUpdate() { } notificationHandlerThread = null; } + + + stopForeground(STOP_FOREGROUND_DETACH); + builder.setContentText(null); + nm.cancel(4); + onDestroy(); } @@ -92,6 +95,7 @@ public int onStartCommand(Intent intent, int flags, int startId) { @Override public void onDestroy() { super.onDestroy(); + stopSelf(); } private void setupNotification() {