Update notification if it is dismissed
This commit is contained in:
@ -522,6 +522,10 @@ class BaresipService: Service() {
|
|||||||
toast(getString(R.string.no_aec), Toast.LENGTH_LONG)
|
toast(getString(R.string.no_aec), Toast.LENGTH_LONG)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"Notification Dismissed" -> {
|
||||||
|
updateStatusNotification()
|
||||||
|
}
|
||||||
|
|
||||||
"Start Content Observer" -> {
|
"Start Content Observer" -> {
|
||||||
registerAndroidContactsObserver()
|
registerAndroidContactsObserver()
|
||||||
}
|
}
|
||||||
@ -1471,10 +1475,19 @@ class BaresipService: Service() {
|
|||||||
.addCategory(Intent.CATEGORY_LAUNCHER)
|
.addCategory(Intent.CATEGORY_LAUNCHER)
|
||||||
val pi = PendingIntent.getActivity(applicationContext, STATUS_REQ_CODE, intent,
|
val pi = PendingIntent.getActivity(applicationContext, STATUS_REQ_CODE, intent,
|
||||||
PendingIntent.FLAG_IMMUTABLE)
|
PendingIntent.FLAG_IMMUTABLE)
|
||||||
|
val deleteIntent = Intent(this, BaresipService::class.java)
|
||||||
|
.setAction("Notification Dismissed")
|
||||||
|
val dpi = PendingIntent.getService(
|
||||||
|
this,
|
||||||
|
STATUS_REQ_CODE,
|
||||||
|
deleteIntent,
|
||||||
|
PendingIntent.FLAG_IMMUTABLE
|
||||||
|
)
|
||||||
val notificationLayout = RemoteViews(packageName, R.layout.status_notification)
|
val notificationLayout = RemoteViews(packageName, R.layout.status_notification)
|
||||||
snb.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
snb.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
||||||
.setSmallIcon(R.drawable.ic_notification_b)
|
.setSmallIcon(R.drawable.ic_notification_b)
|
||||||
.setContentIntent(pi)
|
.setContentIntent(pi)
|
||||||
|
.setDeleteIntent(dpi)
|
||||||
.setOngoing(true)
|
.setOngoing(true)
|
||||||
.setStyle(NotificationCompat.DecoratedCustomViewStyle())
|
.setStyle(NotificationCompat.DecoratedCustomViewStyle())
|
||||||
.setCustomContentView(notificationLayout)
|
.setCustomContentView(notificationLayout)
|
||||||
|
|||||||
Reference in New Issue
Block a user