[Android] Fix network receiver registration

Geoffrey Métais git at videolan.org
Wed Sep 20 14:22:56 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Sep 20 14:22:14 2017 +0200| [6d2d30e69949e27a36a077ab5055d83490580b39] | committer: Geoffrey Métais

Fix network receiver registration

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

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

diff --git a/vlc-android/src/org/videolan/vlc/ExternalMonitor.java b/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
index 3b28795c5..86fa793de 100644
--- a/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
+++ b/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
@@ -64,12 +64,13 @@ public class ExternalMonitor extends BroadcastReceiver {
     }
 
     static void register(Context ctx) {
-        final IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
-        filter.addAction(Intent.ACTION_MEDIA_MOUNTED);
-        filter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
-        filter.addAction(Intent.ACTION_MEDIA_EJECT);
-        filter.addDataScheme("file");
-        ctx.registerReceiver(instance, filter);
+        final IntentFilter networkFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
+        final IntentFilter storageFilter = new IntentFilter(Intent.ACTION_MEDIA_MOUNTED);
+        storageFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
+        storageFilter.addAction(Intent.ACTION_MEDIA_EJECT);
+        storageFilter.addDataScheme("file");
+        ctx.registerReceiver(instance, networkFilter);
+        ctx.registerReceiver(instance, storageFilter);
     }
 
     static void unregister(Context ctx) {



More information about the Android mailing list