[Android] Set Playbackservice foreground only when needed

Geoffrey Métais git at videolan.org
Thu Jun 28 16:57:04 CEST 2018


vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jun 28 16:55:18 2018 +0200| [e04efc0db7d965fc0bfb23211a8eab81f638b2c9] | committer: Geoffrey Métais

Set Playbackservice foreground only when needed

> https://code.videolan.org/videolan/vlc-android/commit/e04efc0db7d965fc0bfb23211a8eab81f638b2c9
---

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 624b0bb52..049164ff4 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -247,7 +247,7 @@ public class PlaybackService extends MediaBrowserServiceCompat{
 
     @Override
     public int onStartCommand(Intent intent, int flags, int startId) {
-        if (AndroidUtil.isOOrLater && !VLCApplication.isForeground()) forceForeground();
+        if (AndroidUtil.isOOrLater && !mIsForeground && !VLCApplication.isForeground()) forceForeground();
         if (intent == null) return START_NOT_STICKY;
         final String action = intent.getAction();
         if (Intent.ACTION_MEDIA_BUTTON.equals(action)) {



More information about the Android mailing list