Example usage for android.app Application getExternalFilesDir

List of usage examples for android.app Application getExternalFilesDir

Introduction

In this page you can find the example usage for android.app Application getExternalFilesDir.

Prototype

@Override
    public File getExternalFilesDir(String type) 

Source Link

Usage

From source file:com.deltadna.android.sdk.DDNA.java

DDNA(Application application, String environmentKey, String collectUrl, String engageUrl, Settings settings,
        @Nullable String hashSecret, @Nullable String clientVersion, @Nullable String userId) {

    this.settings = settings;
    this.clientVersion = clientVersion;

    // FIXME event archive
    final File dir = application.getExternalFilesDir(null);
    final String path = (dir != null) ? dir.getAbsolutePath() : "/";

    preferences = new Preferences(application);
    store = new EventStore(application, settings, preferences);
    archive = new EngageArchive(engageStoragePath = String.format(Locale.US, ENGAGE_STORAGE_PATH, path));

    sessionHandler = new SessionRefreshHandler(application, settings, new SessionRefreshHandler.Listener() {
        @Override/*from   w w w  . j a v a 2 s .co m*/
        public void onExpired() {
            Log.d(BuildConfig.LOG_TAG, "Session expired, updating id");
            newSession(true);
        }
    });
    eventHandler = new EventHandler(store, archive,
            network = new NetworkManager(environmentKey, collectUrl, engageUrl, settings, hashSecret));

    setUserId(userId);
}

From source file:es.javocsoft.android.lib.toolbox.ToolBox.java

/**
 * This method returns the application external folder. All the stuff
 * saved in this folder is deleted when the application is uninstalled.
 * //from   w  w  w  . jav  a2s .  com
 * If the SD folder is not mounted null is returned.
 * 
 * @param app         Application context.
 * @param folder      The type of files directory to return. 
 *                May be null for the root of the app. data directory or 
 *                some folder value.
 * 
 * @return
 */
public static File storage_getAppExternalStorageFolder(Application app, String folder) {
    File res = null;
    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
        res = app.getExternalFilesDir(folder);
    }
    return res;
}