[Android] PlaybackService: init headset detection in service

Thomas Guillem git at videolan.org
Thu Jun 11 19:03:47 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jun 11 18:07:16 2015 +0200| [221ab256d8a3db0939ab9b7aba2c8099d2987a5e] | committer: Thomas Guillem

PlaybackService: init headset detection in service

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=221ab256d8a3db0939ab9b7aba2c8099d2987a5e
---

 vlc-android/src/org/videolan/vlc/PlaybackService.java       |    3 +++
 vlc-android/src/org/videolan/vlc/PlaybackServiceClient.java |    3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 7073408..7420dd6 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -169,6 +169,9 @@ public class PlaybackService extends Service {
             return;
         }
 
+        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+        mDetectHeadset = prefs.getBoolean("enable_headset_detection", true);
+
         mMediaListPlayer = MediaWrapperListPlayer.getInstance();
 
         mCallback = new HashMap<IPlaybackServiceCallback, Integer>();
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackServiceClient.java b/vlc-android/src/org/videolan/vlc/PlaybackServiceClient.java
index 9442cbf..764b030 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackServiceClient.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackServiceClient.java
@@ -113,8 +113,6 @@ public class PlaybackServiceClient {
         if (!mIsBound) {
             Intent service = new Intent(context, PlaybackService.class);
 
-            SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
-            final boolean enableHS = prefs.getBoolean("enable_headset_detection", true);
 
             // Setup audio service connection
             mServiceConnection = new ServiceConnection() {
@@ -135,7 +133,6 @@ public class PlaybackServiceClient {
                     // Register controller to the service
                     try {
                         mIService.addAudioCallback(mCallback);
-                        mIService.detectHeadset(enableHS);
                         if (connectionListerner != null)
                             connectionListerner.onConnectionSuccess();
                     } catch (RemoteException e) {



More information about the Android mailing list