Files saved to Cache dir are always MODE

There are two options to save to internal storage:

  • 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();

  • 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?


    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 .

    链接地址: http://www.djcxy.com/p/90018.html

    上一篇: 服务在Linux上包装一个Windows服务

    下一篇: 保存到Cache dir的文件始终为MODE