Placed .nomedia in the external files directory

This commit is contained in:
daniel oeh 2012-08-12 14:21:36 +02:00
parent 1dce5a3061
commit 71593ddeb3
1 changed files with 16 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package de.danoeh.antennapod;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import android.app.AlarmManager;
@ -49,11 +50,26 @@ public class PodcastApp extends Application implements
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(this);
createImportDirectory();
createNoMediaFile();
prefs.registerOnSharedPreferenceChangeListener(this);
FeedManager manager = FeedManager.getInstance();
manager.loadDBData(getApplicationContext());
}
/** Create a .nomedia file to prevent scanning by the media scanner. */
private void createNoMediaFile() {
File f = new File(getExternalFilesDir(null), ".nomedia");
if (!f.exists()) {
try {
f.createNewFile();
} catch (IOException e) {
Log.e(TAG, "Could not create .nomedia file");
e.printStackTrace();
}
if (AppConfig.DEBUG) Log.d(TAG, ".nomedia file created");
}
}
/**
* Creates the import directory if it doesn't exist and if storage is
* available