fix: Clear notifications on device switch (#2281)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2025-06-28 14:50:05 +00:00 committed by GitHub
parent 9cde2f1b1a
commit 7e6bf21e2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View file

@ -2040,9 +2040,14 @@ class MeshService : Service(), Logging {
putString("device_address", deviceAddr)
}
clearDatabases()
clearNotifications()
}
}
}
private fun clearNotifications() {
serviceNotifications.clearNotifications()
}
private val binder = object : IMeshService.Stub() {
override fun setDeviceAddress(deviceAddr: String?) = toRemoteExceptions {

View file

@ -61,6 +61,10 @@ class MeshServiceNotifications(
// We have two notification channels: one for general service status and another one for messages
val notifyId = 101
fun clearNotifications() {
notificationManager.cancelAll()
}
fun initChannels() {
// create notification channels on service creation
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {