ZiviMagic
ZiviMagic

Reputation: 1054

Files saved to Cache dir are always MODE_PRIVATE?

There are two options to save to internal storage:

  1. files dir, which is a persistence folder which doesn't get deleted when storage space is low:

    outputStream = openFileOutput(filename, Context.MODE_PRIVATE); outputStream.write(string.getBytes()); outputStream.close();

  2. cache dir, which is a persistence folder which gets deleted when the storage space is low:

    file = File.createTempFile(fileName, null, context.getCacheDir());

My question: Will files saved to the cache dir act like the MODE_PRIVATE in the files dir? meaning - will they be accessible only to my app, or will other apps also be able to access the files?

Upvotes: 1

Views: 997

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007634

Will files saved to the cache dir act like the MODE_PRIVATE in the files dir?

Yes.

will they be accessible only to my app

Yes.

or will other apps also be able to access the files?

No, unless you provide access by some other means, such as a streaming ContentProvider.

Upvotes: 4

Related Questions