Skip to content

Commit

Permalink
Try to fix (?) #2212 again
Browse files Browse the repository at this point in the history
  • Loading branch information
tuomas2 committed Dec 31, 2022
1 parent c8275fb commit 6474bbc
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.graphics.BitmapFactory
import android.net.Uri
import android.os.Build
import android.os.IBinder
import android.os.PowerManager
Expand Down Expand Up @@ -134,7 +133,11 @@ class TextToSpeechNotificationManager {

Log.i(TAG, "STOP_SERVICE")
wakeLock.release()
stopForeground(removeNotification)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
stopForeground(if(removeNotification) STOP_FOREGROUND_REMOVE else STOP_FOREGROUND_DETACH)
} else {
stopForeground(removeNotification)
}
foreground = false
}

Expand Down Expand Up @@ -237,7 +240,7 @@ class TextToSpeechNotificationManager {
}

fun onEventMainThread(ev: SpeakEvent) {
Log.i(TAG, "SpeakEvent $ev")
Log.i(TAG, "SpeakEvent ${ev.speakState}")
if(!ev.isSpeaking && ev.isPaused) {
Log.i(TAG, "Stop foreground (pause)")
buildNotification(false)
Expand Down

0 comments on commit 6474bbc

Please sign in to comment.