Show status notification without delay at Android 12

This commit is contained in:
Jonas Lochmann 2021-09-20 02:00:00 +02:00
parent 70f04bf49f
commit 3d5a5a338f
No known key found for this signature in database
GPG key ID: 8B8C9AEE10FA5B36
2 changed files with 2 additions and 1 deletions

View file

@ -160,6 +160,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.core:core:1.7.0-beta01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0' implementation 'androidx.gridlayout:gridlayout:1.0.0'

View file

@ -82,7 +82,7 @@ class BackgroundService: Service() {
.setOngoing(true) .setOngoing(true)
.setPriority(NotificationCompat.PRIORITY_LOW) .setPriority(NotificationCompat.PRIORITY_LOW)
.setVisibility(NotificationCompat.VISIBILITY_SECRET) .setVisibility(NotificationCompat.VISIBILITY_SECRET)
// TODO: Use setForegroundServiceBehavior() when this builder supports it .setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE)
.let { builder -> .let { builder ->
if (appStatusMessage.showSwitchToDefaultUserOption) { if (appStatusMessage.showSwitchToDefaultUserOption) {
builder.addAction( builder.addAction(