[Android] Use util class to start service in remote receiver

Geoffrey Métais git at videolan.org
Mon Nov 27 15:53:53 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Nov 27 15:53:05 2017 +0100| [da1c44acbf9e1c828660435513f1f03676c0d154] | committer: Geoffrey Métais

Use util class to start service in remote receiver

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

 vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java b/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
index 8da618f04..9ce276ac7 100644
--- a/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
+++ b/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
@@ -42,9 +42,9 @@ public class RemoteControlClientReceiver extends MediaButtonReceiver {
 
     @Override
     public void onReceive(Context context, Intent intent) {
-        String action = intent.getAction();
+        final String action = intent.getAction();
 
-        KeyEvent event = intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
+        final KeyEvent event = intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
         if (event != null && action.equalsIgnoreCase(Intent.ACTION_MEDIA_BUTTON)) {
 
             if (event.getKeyCode() != KeyEvent.KEYCODE_HEADSETHOOK &&
@@ -111,7 +111,7 @@ public class RemoteControlClientReceiver extends MediaButtonReceiver {
         } else if (action.equals(PlaybackService.ACTION_REMOTE_PLAYPAUSE)) {
             intent = new Intent(context, PlaybackService.class);
             intent.setAction(PlaybackService.ACTION_REMOTE_PLAYPAUSE);
-            context.startService(intent);
+            Util.startService(context, intent);
             return;
         }
         if (!AndroidUtil.isOOrLater) //We need AppCompat 26+ for Oreo service management



More information about the Android mailing list