Skip to content

Commit

Permalink
Dismissing notification now also stops media playback.
Browse files Browse the repository at this point in the history
Also protect our notification from clear-all and set it as "ongoing".

Fixes #2.
  • Loading branch information
fischman committed Dec 8, 2023
1 parent 913a4f2 commit f5fbdfe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 0 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ android {
targetSdk = 33
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ class NotificationListener : NotificationListenerService() {
.setContentTitle(label)
.setContentText("")
.setCategory(Notification.CATEGORY_ALARM)
.setOngoing(true)
.setFlag(Notification.FLAG_NO_CLEAR, true)
.setDeleteIntent(stopPlayingIntent)
.addAction(
Notification.Action.Builder(android.R.drawable.stat_notify_call_mute, "Stop", stopPlayingIntent)
.setSemanticAction(Notification.Action.SEMANTIC_ACTION_MUTE)
Expand Down

0 comments on commit f5fbdfe

Please sign in to comment.