[Android] Init Medialibrary if it's been crashed

Geoffrey Métais git at videolan.org
Thu Jun 15 15:48:20 CEST 2017


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

Init Medialibrary if it's been crashed

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

 .../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..c283fb155 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 (!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