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.
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.