[Android] Remove startService call from NotificationHelper

Geoffrey Métais git at videolan.org
Tue Oct 10 11:28:25 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Oct 10 10:00:50 2017 +0200| [eae9850456d2f99cb94f8a1fcc918b14ed596362] | committer: Geoffrey Métais

Remove startService call from NotificationHelper

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

 .../src/org/videolan/vlc/gui/helpers/NotificationHelper.java  | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.java b/vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.java
index 3befe1c81..8f706ba62 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.java
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/NotificationHelper.java
@@ -79,12 +79,12 @@ public class NotificationHelper {
             builder.addAction(R.drawable.ic_widget_close_w, ctx.getString(R.string.stop), piStop);
 
             if (AndroidDevices.showMediaStyle) {
-                builder.setStyle(new Notification.MediaStyle()
-                        .setMediaSession((MediaSession.Token) sessionToken.getToken())
-                        .setShowActionsInCompactView(0,1,2)
-                );
+                final Notification.MediaStyle ms = new Notification.MediaStyle()
+                        .setShowActionsInCompactView(0,1,2);
+                if (sessionToken != null)
+                    ms.setMediaSession((MediaSession.Token) sessionToken.getToken());
+                builder.setStyle(ms);
             }
-            ctx.startForegroundService(new Intent(ctx, PlaybackService.class));
             return builder.build();
         } else {
             final NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx);
@@ -114,7 +114,6 @@ public class NotificationHelper {
                         .setCancelButtonIntent(piStop)
                 );
             }
-            ctx.startService(new Intent(ctx, PlaybackService.class));
             return builder.build();
         }
     }



More information about the Android mailing list