Fix plugin setup pending intent background permission

This commit is contained in:
MM20
2024-02-20 22:03:23 +01:00
parent 1e17e93301
commit 01ea2a2862
2 changed files with 23 additions and 2 deletions
@@ -0,0 +1,20 @@
package de.mm20.launcher2.ktx
import android.app.ActivityOptions
import android.app.PendingIntent
fun PendingIntent.sendWithBackgroundPermission() {
if (isAtLeastApiLevel(34)) {
val options = ActivityOptions.makeBasic()
.setPendingIntentCreatorBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED
)
.setPendingIntentBackgroundActivityStartMode(
ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED
)
.toBundle()
send(options)
} else {
send()
}
}