restart notification listener service
You can use broadcast reciever for notify or cancel
//in your notificaitonListener service
private var stateReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
when (intent?.action) {
"update" -> {
notification()
}
"delete" -> {
}
}
}
}
//this for activity or fragment
Timer().schedule(1500) {
delay for notification service may be not start in application start
val stateNotification = Intent("update")
requireActivity().sendBroadcast(stateNotification)
}