1

I used Environment.getExternalStorageDirectory() for create directory and save my application file inside of it. till android 8 my application work fine but in higher level it is not working and i cant save any file in primary location and i have to save it in ../Android/data/MY_PACKAGE_NAME. I think it is because of android new policy but now i see there is lot of application which able to make directory and save file in primary storage, I really want to save file in primary storage please help me if three is a solution.

I add android:requestLegacyExternalStorage="true" into manifest and also this below permission granted:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Mostafa
  • 45
  • 10
  • Did you check this [post](https://stackoverflow.com/a/58379655/6183507)? – Mustafa Kuloğlu Dec 16 '20 at 22:06
  • @MustafaKuloğlu yes but it not solve my problem. – Mostafa Dec 16 '20 at 23:30
  • @Mostafa: so you've actually tried all three choices explained at the bottom of that post and none of them helped you? Then please tell us why each one didn't work for you, because otherwise we can't give you a different answer to what that one says. – Joachim Sauer Dec 17 '20 at 11:11
  • @JoachimSauer the answer that provided in that post say a solution for saving file in ../Android/data/package_name directory which files delete when application uninstalled i don't want to save my file in that directory. – Mostafa Dec 19 '20 at 16:22
  • Are you still looking for answer? – Nadim Ansari Oct 27 '21 at 05:06

0 Answers0