I'm trying to write to my own app's private directory in Android, which should require no permissions.
It is failing.
val now = LocalDateTime.now()
channelDataFile = File(applicationContext.filesDir, "channel_${now.year}-${now.month}-${now.dayOfMonth}-${now.hour}-${now.minute}-${now.second}.csv")
val fileWriter = FileWriter(channelDataFile.name)
val printWriter = PrintWriter(fileWriter)
The fileWriter line is throwing a android.system.ErrnoException: open failed: EROFS (Read-only file system).
I have tried adding a "/" in front of the filename. The applicationContext.filesDir correctly maps out to my app's data directory, "/data/user/0/com.redacted.redacted/files".
Why am I getting this exception? I just need to write files to the private directory and read them.