Android Question Writting in external SDcard

Javier Mateo

Member
Licensed User
I'm a little bit bloked because I have problems when I try to copy a file (write a file) in the external Sdcard.
I have always writen in external Sdcard in rooted devices, but now I have some devices that I can not make the root.
I make the permissions modifications in the manifiest file, but I can't copy the a backup files.
I always receive denied access messages.
Do you think that I have to ask the permission in run time?
The versión of Android is 5.1.

Could you help me about This problem?

Thanks.
 

Javier Mateo

Member
Licensed User
Thanks Erel. But I don't know how solve my problem.

This is very useful when I need to use for restore my database but I need copy my database from File.DirInternal or File.DirRootExternal to SDCard/Backup (or SDCard/Safety) and I don’t know how get the path where I want to make the backup of my database, and alwais received the same error:


java.io.FileNotFoundException: /storage/36BB-67FD/myCarpeta/Progescom_T4.db3 (Permission denied)


This is the state of the art


Thanks a million
 
Upvote 0

Javier Mateo

Member
Licensed User
Thanks Erel.

I know, but in the example I read from the SDCard and write to the Files.DirInternal and I want to do the contrary, read from Files.DirInternal and write in a forlder of SDCard and I don't know how can I do.

PD I have run the example, and I use some parts of this code.
 
Upvote 0

Javier Mateo

Member
Licensed User
"You should use CreateNewFile and then OpenOutputStream. You can then copy a file with File.Copy2."


I understand how can I do the copy, and understand how works 'File.Copy2' instruction. My problem is that I don't know how get the correct path in sdcard.

How can get (reach) the path in the SDCard?

Thanks a million Erel.
 
Upvote 0
Top