[Android] MediaParsingService: Always set foreground Oreo+
Geoffrey Métais
git at videolan.org
Fri Aug 9 15:04:45 CEST 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Aug 9 13:57:12 2019 +0200| [828ffce2949538f11d1ad55d9cc2b0de843f3037] | committer: Geoffrey Métais
MediaParsingService: Always set foreground Oreo+
> https://code.videolan.org/videolan/vlc-android/commit/828ffce2949538f11d1ad55d9cc2b0de843f3037
---
vlc-android/src/org/videolan/vlc/MediaParsingService.kt | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
index 8d371d4c2..79b67ce05 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
@@ -128,15 +128,14 @@ class MediaParsingService : Service(), DevicesDiscoveryCb, CoroutineScope, Lifec
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
- if (intent == null) {
- exitCommand()
- return Service.START_NOT_STICKY
- }
// Set 1s delay before displaying scan icon
// Except for Android 8+ which expects startForeground immediately
-
if (AndroidUtil.isOOrLater) forceForeground()
else if (lastNotificationTime <= 0L) lastNotificationTime = System.currentTimeMillis()
+ if (intent == null) {
+ exitCommand()
+ return Service.START_NOT_STICKY
+ }
dispatcher.onServicePreSuperOnStart()
when (intent.action) {
ACTION_INIT -> {
More information about the Android
mailing list