Android Question Access Files

Mike Parris

Member
Licensed User
Longtime User
I am writing an app that needs to allow users to read and write text files. I am confused with all the information regarding file access, permissons and Android version 30. So can someone detail how I can achieve the following -

1. I would like to offer my App through the Google Play store.
2. Users need to load data to the App via text files and store results by reading text files. In order to achieve this they will need a way of accessing their files presumably by using a file manager app.
3. If I access files using the File.DirInternal, files are not available using a file manager. GetSafeDirDefaultExternal does what I need but will store files on an external drive if one is fitted. Would this mean that the location where my App stores data would change if the user added an SD card?

Have I misunderstood something or is there some functionality that I have missed? Are Google not allowing Apps with functionality like mine in the Play Store?
 

agraham

Expert
Licensed User
Longtime User
GetSafeDirDefaultExternal does what I need but will store files on an external drive if one is fitted.
I don't think this is true. It returns a folder in the "internal" external memory - not the SD card. The terminology confusion arises from early Android where SD cards were the only bulk memory.
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
Upvote 0

Mike Parris

Member
Licensed User
Longtime User
I ran tests using GetSafeDirDefaultExternal and did find that files were saved to the "internal" storage and not the external SD Card.
Interestingly, my App created folders and in addition to being created in the internal memory they were also created on the attached SD Card. The file, however, was only copied to the internal memory and not the SD card.
The test device was running Android 8.1.0
 
Upvote 0
Top