[Android] Init Medialibrary if it's been crashed

Geoffrey Métais git at videolan.org
Thu Jun 15 15:53:42 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jun 15 15:47:57 2017 +0200| [022deb1b9e5bf88cd9b14fa12467589baaafc831] | committer: Geoffrey Métais

Init Medialibrary if it's been crashed

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

 .../src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java     | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
index d0fe69c4a..f53f88b63 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
@@ -60,9 +60,13 @@ import org.videolan.vlc.gui.audio.AudioPlayer;
 import org.videolan.vlc.gui.browser.StorageBrowserFragment;
 import org.videolan.vlc.interfaces.IRefreshable;
 import org.videolan.vlc.media.MediaUtils;
+import org.videolan.vlc.util.Permissions;
 import org.videolan.vlc.util.Strings;
 import org.videolan.vlc.util.WeakHandler;
 
+import static org.videolan.vlc.StartActivity.EXTRA_FIRST_RUN;
+import static org.videolan.vlc.StartActivity.EXTRA_UPGRADE;
+
 public class AudioPlayerContainerActivity extends BaseActivity implements PlaybackService.Client.Callback {
 
     public static final String TAG = "VLC/AudioPlayerContainerActivity";
@@ -93,6 +97,9 @@ public class AudioPlayerContainerActivity extends BaseActivity implements Playba
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
+        //Init Medialibrary if KO
+        if (savedInstanceState != null && !VLCApplication.getMLInstance().isInitiated() && Permissions.canReadStorage())
+            startService(new Intent(MediaParsingService.ACTION_INIT, null, this, MediaParsingService.class));
         MediaUtils.updateSubsDownloaderActivity(this);
         super.onCreate(savedInstanceState);
     }



More information about the Android mailing list