mqtt-android-tutorial icon indicating copy to clipboard operation
mqtt-android-tutorial copied to clipboard

Notification is not removing when we set setForegroundService in mqtt client

Open Monika-Paliwal opened this issue 3 years ago • 0 comments

We have added the notification in mqtt for show the notification in notification bar but when we logout the app the notification bar still showing. We have used below mentioned code. mqttClient!!.setForegroundService(notification.build(), notificationId) And also used code for cancel notification val notificationManager = context getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager notificationManager.cancel(notificationId)

Can you please provide the solution for stop the foreground service.

Monika-Paliwal avatar Dec 10 '21 11:12 Monika-Paliwal