0

I want to edit a file with ini format. There is no problem outside the Android/data folder and it works, but I want to access it in the following path.

Direction :

/Android/data/com.xxx.xxx/files/xxx/xxx.ini

Error:

"/storage/emulated/0/Android/data/com.xxx.xxx/files/xxx/xxx.ini: open failed: EACCES (Permission denied)"

permissions

`<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
        tools:ignore="QueryAllPackagesPermission" />
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
        tools:ignore="ScopedStorage"/>

android:requestLegacyExternalStorage="true"`

Сode

fun Save() {
        val ini = Wini(
            File(
                Environment.getExternalStorageDirectory()
                    .toString() +
                        "/Android/data/com.xxxx.xxx/xxx/xxx/xxx.ini"
            )
        )
        ini.put("client", "name", nickName)
        ini.store()
    }

This code works :

fun SaveNick() {
        val ini = Wini(
            File(
                Environment.getExternalStorageDirectory()
                    .toString() +
                        "/xxx.ini"
            )
        )
        ini.put("client", "name", nickName)
        ini.store()
    }
Mati
  • 1
  • 2
  • `com.xxx.xxx` Is that your apps packaagename? Your app that tries to read the file? – blackapps Feb 17 '23 at 09:10
  • `This code works :` That code normally should not work on Android 11, 12, 13 devices. Only with MANAGE_EXTERNAL_STORAGE fully implemented. – blackapps Feb 17 '23 at 09:12
  • No, there is another program package, I want to use it as a client in my program – Mati Feb 17 '23 at 09:24
  • Your app has no access to other apps app specific directories. Not on Android 11, 12 13 devices. Not even with MANAGE_EXTERNAL_STORAGE. – blackapps Feb 17 '23 at 09:29
  • 1
    Luckily not. Private you know. Would you be glad if other apps messed around with your files? Please if you post again then tell directly that you wanna access to other apps private folder. – blackapps Feb 17 '23 at 09:33
  • Both of these programs are for me, I just want to move information between them, my information is in the file (xxx.ini) are saved – Mati Feb 17 '23 at 09:37
  • 1
    It does not matter that both apps are yours. They are different apps. They have their own privacy. – blackapps Feb 17 '23 at 09:50
  • I created this file (xxx.ini) in my program package and gave the address of the program, but the problem is still the same! – Mati Feb 17 '23 at 09:58
  • Does this answer your question? [Android 11 open failed: EACCES (Permission denied)](https://stackoverflow.com/questions/66964812/android-11-open-failed-eacces-permission-denied) – Halil Ozel Feb 17 '23 at 10:08
  • @HalilOzel No problem reading the package in the folder Android/data – Mati Feb 17 '23 at 10:27
  • @Mati I see. I thought it was a similar problem. – Halil Ozel Feb 17 '23 at 11:36
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Feb 17 '23 at 16:26
  • I want to edit a file in the path I specified above, but it gives me the error I wrote above.@Community – Mati Feb 17 '23 at 16:59

0 Answers0