1. Are you ready for the Galaxy S20? Here is everything we know so far!

Creating a Directory After Android 11

Discussion in 'Android Development' started by Youssef Hammad, May 12, 2021.

  1. Youssef Hammad

    Thread Starter

    I've been searching the internet for almost 7hrs now, I can't seem to find a code that works and it took me a while to find out that the method below no longer works and is deprecated

    Code (Text):
    1. File file = new File(Environment.getExternalStorageDirectory(),sName);
    2. file.mkdirs();
    Also tried adding android:requestLegacyExternalStorage="true" in the manifest but still the same result.

    So my question is: Is it possible to create a directory directly in internal storage automatically when the app starts for the first time, similar to what WhatsApp does?

    Like if someone downloads and opens the app for the first time there'd be a new directory created (after gaining the permission to do so) in Internal Storage directly (not in Android/data sub-folders) for the app files in the future

    And if it's possible, how can I do such a thing?

    I'd be very grateful for as little as any pointer in that direction, I've been on this issue for much more time than I expected

    Thank you in advance
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...
Similar Threads - Creating Directory Android
  1. Kuldip Somwanshi
    Replies:
    0
    Views:
    621
  2. Davide Vergnani
    Replies:
    0
    Views:
    525
  3. xpressive
    Replies:
    0
    Views:
    654
  4. Nabeel Rajabali
    Replies:
    1
    Views:
    811
  5. androinewbi
    Replies:
    6
    Views:
    1,196
  6. MackOS
    Replies:
    0
    Views:
    537
  7. Murphler
    Replies:
    0
    Views:
    854
  8. App Update
    Replies:
    1
    Views:
    376
  9. electricpunch
    Replies:
    1
    Views:
    429
  10. Natann99
    Replies:
    0
    Views:
    803

Share This Page

Loading...