From 1b587ab82a4cf69e676788d8089a147d491163e7 Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Mon, 28 Nov 2022 12:39:03 -0500 Subject: [PATCH] Set ongoing flag for foreground notification to prevent swiping away on Android 13 --- app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt | 1 + fastlane/metadata/android/en-US/changelog/29.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt b/app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt index 7d6355f..103ff1c 100644 --- a/app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt +++ b/app/src/main/java/io/heckel/ntfy/service/SubscriberService.kt @@ -297,6 +297,7 @@ class SubscriberService : Service() { .setContentIntent(pendingIntent) .setSound(null) .setShowWhen(false) // Don't show date/time + .setOngoing(true) // Starting SDK 33 / Android 13, foreground notifications can be swiped away .setGroup(NOTIFICATION_GROUP_ID) // Do not group with other notifications .build() } diff --git a/fastlane/metadata/android/en-US/changelog/29.txt b/fastlane/metadata/android/en-US/changelog/29.txt index 3bb7643..805d904 100644 --- a/fastlane/metadata/android/en-US/changelog/29.txt +++ b/fastlane/metadata/android/en-US/changelog/29.txt @@ -5,6 +5,7 @@ Bug fixes + maintenance: * Upgrade Android dependencies and build toolchain to SDK 33 (no ticket) * Simplify F-Droid build: Disable tasks for Google Services (#516, thanks to @markosopcic) * Android 13: Ask for permission to post notifications (#508) +* Android 13: Do not allow swiping away the foreground notification (#521, thanks to @alexhorner for reporting) * Remove timestamp when copying message text (#471, thanks to @wunter8) * Fix auto-delete if some icons do not exist anymore (#506) * Fix notification icon color (#480, thanks to @s-h-a-r-d for reporting)