2

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().

Ruli
  • 2,592
  • 12
  • 30
  • 40
BugsCreator
  • 433
  • 3
  • 10
  • `getFilesDir() , getDir() : it properly works in android 10 but it creates folder and file in android->data->com.mycompany.myapp->here` Wrong. That is not the used path. Please find out the real path. – blackapps Feb 06 '21 at 07:56
  • 1
    `getExternalFilesDir(String type): 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 )` No. It does not create a folder in root (whatever you think root is) and it works perfectly fine in Android 10 and 11 too. – blackapps Feb 06 '21 at 07:58
  • `what is the root directory?` All starts with knowing what the root is. Well find out. Take a decent file manager/explorer. Browse. Investigate and you will know. – blackapps Feb 06 '21 at 08:00
  • this is not your android root directory its an internal storage directory I know what Is root and how to access it – BugsCreator Feb 06 '21 at 08:42
  • i use getDir() and it making folder in android->data->com.mycompany.myapp->here – BugsCreator Feb 06 '21 at 08:43
  • sorry I'm using getExternalStorageDirectory() to get the path of and it not working in android 10 – BugsCreator Feb 06 '21 at 08:45
  • `use getDir() and it making folder in android->data->com.mycompany.myapp->here` No. Wrong. And you even repeat this error although you were corrected. – blackapps Feb 06 '21 at 08:59
  • `I'm using getExternalStorageDirectory() to get the path`. Well Tell that path!! And tell what you consider to be root! Also tell full path of all other 'get' functions you mentioned. – blackapps Feb 06 '21 at 09:00
  • actually, I got the solution https://stackoverflow.com/questions/63842070/accessing-external-storage-in-android-api-29/63842348#63842348 one of your answers the reason is I'm not adding permissions to manifest – BugsCreator Feb 06 '21 at 09:10

0 Answers0