Commit f32739cf authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Delay storages check

Ensure app is foreground when we start service
parent 54e4a066
......@@ -76,14 +76,18 @@ public class ExternalMonitor extends BroadcastReceiver {
storageFilter.addDataScheme("file");
ctx.registerReceiver(instance, networkFilter);
ctx.registerReceiver(instance, storageFilter);
if (AndroidUtil.isICSOrLater)
checkNewStorages(ctx);
}
private static void checkNewStorages(final Context ctx) {
if (VLCApplication.getMLInstance().isInitiated())
if (AndroidUtil.isICSOrLater && VLCApplication.getMLInstance().isInitiated())
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
ctx.startService(new Intent(Constants.ACTION_CHECK_STORAGES, null,ctx, MediaParsingService.class));
}
});
}
static void unregister(Context ctx) {
ctx.unregisterReceiver(instance);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment