[Android] Set RemoteControlClientReceiver intents explicit

Geoffrey Métais git at videolan.org
Fri Mar 31 10:16:02 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Mar 31 10:15:04 2017 +0200| [415e80cb845f634a7c469cf1fbd8ea64a663b88d] | committer: Geoffrey Métais

Set RemoteControlClientReceiver intents explicit

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

 .../org/videolan/vlc/RemoteControlClientReceiver.java  | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java b/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
index b1406ab..866c238 100644
--- a/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
+++ b/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
@@ -70,35 +70,33 @@ public class RemoteControlClientReceiver extends MediaButtonReceiver {
                         case KeyEvent.ACTION_UP:
                             if (AndroidDevices.hasTsp()) { //no backward/forward on TV
                                 if (time - mHeadsetDownTime >= 1000) { // long click
-                                    i = new Intent(PlaybackService.ACTION_REMOTE_BACKWARD);
+                                    i = new Intent(PlaybackService.ACTION_REMOTE_BACKWARD, null, VLCApplication.getAppContext(), PlaybackService.class);
                                     break;
                                 } else if (time - mHeadsetUpTime <= 500) { // double click
-                                    i = new Intent(PlaybackService.ACTION_REMOTE_FORWARD);
+                                    i = new Intent(PlaybackService.ACTION_REMOTE_FORWARD, null, VLCApplication.getAppContext(), PlaybackService.class);
                                     break;
                                 }
                             }
                             // one click
-                            i = new Intent(PlaybackService.ACTION_REMOTE_PLAYPAUSE);
+                            i = new Intent(PlaybackService.ACTION_REMOTE_PLAYPAUSE, null, VLCApplication.getAppContext(), PlaybackService.class);
                             mHeadsetUpTime = time;
                             break;
                     }
                     break;
                 case KeyEvent.KEYCODE_MEDIA_PLAY:
-                    i = new Intent(context, PlaybackService.class);
-                    i.setAction(PlaybackService.ACTION_REMOTE_PLAY);
-                    context.startService(i);
+                    context.startService(new Intent(PlaybackService.ACTION_REMOTE_PLAY, null, VLCApplication.getAppContext(), PlaybackService.class));
                     return;
                 case KeyEvent.KEYCODE_MEDIA_PAUSE:
-                    i = new Intent(PlaybackService.ACTION_REMOTE_PAUSE);
+                    i = new Intent(PlaybackService.ACTION_REMOTE_PAUSE, null, VLCApplication.getAppContext(), PlaybackService.class);
                     break;
                 case KeyEvent.KEYCODE_MEDIA_STOP:
-                    i = new Intent(PlaybackService.ACTION_REMOTE_STOP);
+                    i = new Intent(PlaybackService.ACTION_REMOTE_STOP, null, VLCApplication.getAppContext(), PlaybackService.class);
                     break;
                 case KeyEvent.KEYCODE_MEDIA_NEXT:
-                    i = new Intent(PlaybackService.ACTION_REMOTE_FORWARD);
+                    i = new Intent(PlaybackService.ACTION_REMOTE_FORWARD, null, VLCApplication.getAppContext(), PlaybackService.class);
                     break;
                 case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
-                    i = new Intent(PlaybackService.ACTION_REMOTE_BACKWARD);
+                    i = new Intent(PlaybackService.ACTION_REMOTE_BACKWARD, null, VLCApplication.getAppContext(), PlaybackService.class);
                     break;
             }
 



More information about the Android mailing list