How to create private folder in sdcard

前端 未结 5 1903
名媛妹妹
名媛妹妹 2021-02-05 16:05

My application is used for security purpose. so, from my application user captures photos that all photos are stored in a folder that folder should not access from any other app

相关标签:
5条回答
  • 2021-02-05 16:34

    Try following solution:

    How to store a file in Hidden mode

    Although it is not exactly what you want and I doubt whether it is possible or not. The best option would be to make it hidden but that also works with constraint (works for linux and not for Windows, still other applications can access the folder)

    How to hide the folder of sdcard in android

    How to make a file hidden in android sd card?

    0 讨论(0)
  • 2021-02-05 16:36

    Its not possible to give no access to that folder when device connected to pc.. Also its not possible on sdcard also, But you can use different format for images that can be opened only from your application, or you can encrypt images. Or if you want to hide images from showing them into gallery, you can put a blank file with name as ".nomedia" in your folder. But its not possible cause if u read docs about WRITE_EXTERNEL_STORAGE permission you will understand what I am saying. :)

    0 讨论(0)
  • 2021-02-05 16:56

    According to this guide, you can save files directly on the device's internal storage. By default, files saved to the internal storage are private to your application and other applications cannot access them (nor can the user). When the user uninstalls your application, these files are removed. For example:

    String FILENAME = "hello_file";
    String string = "hello world!";
    FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
    fos.write(string.getBytes());
    fos.close();
    

    MODE_PRIVATE will create the file (or replace a file of the same name) and make it private to your application. Other modes available are: MODE_APPEND, MODE_WORLD_READABLE, and MODE_WORLD_WRITEABLE.

    0 讨论(0)
  • 2021-02-05 16:58

    The only way, AFAIK is to encrypt the files that you store. There is no way to prevent users mount the sdcard to access every file stored in it.

    0 讨论(0)
  • 2021-02-05 16:58

    according to this related question, you can only create protected files in internal storage (not on the SD)...

    Create Folder that can not accessible by any other application

    0 讨论(0)
提交回复
热议问题