Home > Back-end >  Delphi android how to read and write the external memory card? (get)
Delphi android how to read and write the external memory card? (get)

Time:11-11

Written in Delphi 10.3 an android APP, file read and write operations, is required to read text files on the memory card in the memo, after the change in the original directory to save to another file; When files in the built-in memory card, read and write (with Memo. Lines. SaveToFile (FilePath)) no problem, but when a file is in the outside buy memory card, read no problem, when writing prompts "always create a file"/XXXX (external SD card path)/file name "permission denied"

Is access into consideration, then check in the project file to read and write the external storage, and allow the user to point to confirm when the program is running, in android Settings can program has gained the store permissions, but also appears the above tips, is it only read, write two rights is not enough, or what other reason? Great god answer, thank you!

CodePudding user response:

Permissions list chose the Read only External Storage and Write External Storage, and access permissions to the name of the for
TJManifest_permission. JavaClass. READ_EXTERNAL_STORAGE;
TJManifest_permission. JavaClass. WRITE_EXTERNAL_STORAGE;

This is not the external memory card? If you chose to refuse, when start the authorization will find that even the built-in storage can't read, what reason be?

CodePudding user response:

Top by oneself, it seems this thing really difficult?

CodePudding user response:

Try TPath getDocumentPath or getSharedDocumentPat directory h, write this,

CodePudding user response:

Linux create directory, you need to chmod command to set the permissions, android directory may be associated with this,

CodePudding user response:

Thank answer upstairs, I with you say TPath method to get the catalogue and the program itself a documents folder, they are all in the built-in storage card, not in the external storage, I want to achieve is to the whole external memory card read and write access, similar to the function of the file manager, chmod as to what you say, can implement a program to access file? How to implement under the android, with Delphi?

CodePudding user response:

You baidu "Linux file directory permissions", as well as the root user permissions, other I don't understand,

CodePudding user response:

I also find a few days, I found the DELPHI's own directory class TPath is of no external memory card function, I retest all of its function, found that take less than, it is really hurt,

CodePudding user response:

Reading is no problem, as long as the path is correct, the main problem is read only, can't write, don't know how to get permission

CodePudding user response:

Find the JAVA method, considered the JAVA class into Delphi pas but failed, the switch won't compile
  • Related