[Android] Broadcast start and finish scanning events

Geoffrey Métais git at videolan.org
Wed Apr 19 14:45:56 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Apr 18 15:30:38 2017 +0200| [c40305aac9dfbf6f6fc6b63a3b2535010c1cef77] | committer: Geoffrey Métais

Broadcast start and finish scanning events

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

 vlc-android/src/org/videolan/vlc/MediaParsingService.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.java b/vlc-android/src/org/videolan/vlc/MediaParsingService.java
index 776c41d..ec43be1 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.java
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.java
@@ -44,6 +44,8 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
 
     public final static String ACTION_RESUME_SCAN = "action_resume_scan";
     public final static String ACTION_PAUSE_SCAN = "action_pause_scan";
+    public final static String ACTION_SERVICE_STARTED = "action_service_started";
+    public final static String ACTION_SERVICE_ENDED = "action_service_ended";
     public static final long NOTIFICATION_DELAY = 1000L;
     private PowerManager.WakeLock mWakeLock;
 
@@ -120,6 +122,7 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
                 discoverStorage(intent.getStringExtra(EXTRA_PATH));
                 break;
         }
+        LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(ACTION_SERVICE_STARTED));
         return START_NOT_STICKY;
     }
 
@@ -304,6 +307,7 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
 
     @Override
     public void onDestroy() {
+        LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(ACTION_SERVICE_ENDED));
         hideNotification();
         mMedialibrary.removeDeviceDiscoveryCb(this);
         unregisterReceiver(mReceiver);



More information about the Android mailing list