, , , , USB- , OTG , , usb ( , 4.4 ?) , , , Galaxy S4 (Play Store edition) N5.
if (mExportServiceUri.getHost().equals("com.android.externalstorage.documents")) {
final String encodedPath = mExportServiceUri.getEncodedPath();
final String path = encodedPath.substring(encodedPath.indexOf("%3A") + 3);
final File[] storagePoints = new File("/storage").listFiles();
if (encodedPath.startsWith("/document/primary")) {
final File externalFile = new File(Environment.getExternalStorageDirectory(), path);
MediaScannerConnection.scanFile(mService.getApplicationContext(),
new String[] { externalFile.getAbsolutePath() }, null, null);
} else {
for (int i = 0, j = storagePoints.length; i < j; ++i) {
final File externalFile = new File(storagePoints[i], path);
if (externalFile.exists()) {
MediaScannerConnection.scanFile(mService.getApplicationContext(),
new String[] { externalFile.getAbsolutePath() }, null, null);
break;
}
}
}
}