List of usage examples for android.media MediaScannerConnection isConnected
public synchronized boolean isConnected()
From source file:com.frostwire.android.gui.UniversalScanner.java
private static void onMediaScannerConnected(MediaScannerConnection connection, Collection<File> files) { if (files == null || connection == null) { return;/*from w w w .j ava2 s. c o m*/ } try { /* should only arrive here on connected state, but let's double check since it's possible */ if (connection.isConnected() && !files.isEmpty()) { for (File f : files) { connection.scanFile(f.getAbsolutePath(), null); } } } catch (IllegalStateException e) { LOG.warn("Scanner service wasn't really connected or service was null", e); //should we try to connect again? don't want to end up in endless loop //maybe destroy connection? } }