How to create a root folder in internal memory in android 10 (android studio)

Viewed 549

I need to create a folder (can be a file ) in internal storage in android 10. I just need the absolute path of the folder that was created previously so I can write files there. What is the internal storage root directory? Suppose that this is my internal dir:

android
awsfolder
booksfolder

So this is the root. I need to create a folder here, not in android->data->com.mycompany.myapp->(not here). I have tried following to achieve it:

  • config legacy storage supports to true in mainfest

  • getFilesDir(), getDir() : it properly works in android 10 but it creates folder and file in android->data->com.mycompany.myapp->here

  • getExternalStorageDirectory(): it works perfectly in lower android like 7,8 and 9 also creates a folder in root but it is not working in android 10 (getting error no such a file and folder )

I don't need a cache dir using getCacheDir() and getExternalCacheDir().

0 Answers
Related