[Android] Get telephony manager with service context

Geoffrey Métais git at videolan.org
Wed Mar 7 15:16:50 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar  7 15:14:06 2018 +0100| [33eb5c6ccf91da9f445030aebbeb459798826e5c] | committer: Geoffrey Métais

Get telephony manager with service context

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index fa58444d9..768cd18a8 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -434,7 +434,7 @@ public class PlaybackService extends MediaBrowserServiceCompat{
             final int state = intent.getIntExtra("state", 0);
 
             // skip all headsets events if there is a call
-            final TelephonyManager telManager = (TelephonyManager) VLCApplication.getAppContext().getSystemService(Context.TELEPHONY_SERVICE);
+            final TelephonyManager telManager = (TelephonyManager) PlaybackService.this.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
             if (telManager != null && telManager.getCallState() != TelephonyManager.CALL_STATE_IDLE) return;
 
             /*



More information about the Android mailing list