Invalidating the notification does not refresh custom actions
- Dominant language
- Java
- Stars
- 21.9k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
I have the following implementation of `PlayerNotificationManager.CustomActionReceiver`
```kotlin
override fun createCustomActions(context: Context, instanceId: Int): MutableMap {
return actions.associate {
val intent = Intent(it.type.value).setPackage(context.packageName)
val action = NotificationCompat.Action(it.icon, it.title, PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT))
it.type.value to action
}.toMutableMap()
}
override fun getCustomActions(player: Player): MutableList {
return actions.map { it.type.value }.toMutableList()
}
override fun onCustomAction(player: Player, action: String, intent: Intent) {
scope.launch {
onCustomAction.emit(NotificationActionType.valueOf(action))
}
}
```
The problem is my `actions` arrive late. Not only that, we would like to support updating the custom actions in runtime. Sadly this doesn't seem possible when calling `PlayerNotificationManager.invalidate()`. `createCustomActions()` never gets called again after calling `invalidate()`. This call seems to refresh everything in the notification, except the custom actions.
Is this a known issue?
Contributor guide
Assessment
This issue has not been assessed yet.