mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-02-06 22:02:37 -05:00
fix: Clear notifications on device switch (#2281)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user