[Android] Keep playback service foreground

Geoffrey Métais git at videolan.org
Mon Apr 18 11:29:39 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Apr 18 11:28:53 2016 +0200| [8f60daa8293bac476a190816553cbcfd9b1cd415] | committer: Geoffrey Métais

Keep playback service foreground

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

 vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java b/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
index 459e40b..efa996a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
@@ -413,6 +413,11 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
         Notification notification = builder.build();
         mService.startService(new Intent(mService, PlaybackService.class));
         NotificationManagerCompat.from(mService).notify(42, notification);
+        if (!AndroidUtil.isLolliPopOrLater() || mService.isPlaying())
+            mService.startForeground(3, notification);
+        else {
+            NotificationManagerCompat.from(mService).notify(42, notification);
+        }
     }
 
     private void hideNotification() {



More information about the Android mailing list