file.copy at extsd permission denie

kalarius

Active Member
Licensed User
Longtime User
hi,

with the command
file.copy("/mnt/extsd","mytxt.txt","/mnt/sdcard","mytxt.txt")
I can copy from external Sd card to the internal SD card

with the
File.copy ("/mnt/sdcard","mytxt.txt","/mnt/ext","mytxt.txt")
I get the error permission denie

At then manifest file there is the WRITE_EXTERNAL_STORAGE

*** my device is MK802 and as DirRootExternal=sdcard=/mnt/sdcard
(it is the inside sd card)
the sd card at the mini slot is /mnt/ext
I can read from it but now write to it.

I read at the web that I must include at the manifest the
android.permission.WRITE_MEDIA_STORAGE
and the <group gid="media_rw"/>

I add them to manifest but nothing
just permission denie

HELP

thank
kalarakis
 

mrred128

Active Member
Licensed User
Longtime User
The jist of the "Google Change" is that there are security problems with apps able to read / write anywhere on the device, especially on fat file systems. The change enforces permissions such that you can only read / write on directory trees created by your app. Anywhere else you would need an act of god to get access granted. It doesn't seem that they have thought out how to implement needed exceptions.

I noticed the change first on 4.2 . I don't actually know when they started applying this policy.
 
Upvote 0

mrred128

Active Member
Licensed User
Longtime User
You could also add SetApplicationAttribute(android:installLocation, "auto") or SetApplicationAttribute(android:installLocation, "preferExternal") to your manifest. That would at least put your app on the slice with the most free space, or the ability to move it there later.

I would think "auto" to be the best generic choice.

edit: doesn't seem to get passed down to the app. I don't know if it is a compile issue or a b4a issue.
 
Last edited:
Upvote 0

Bpick

Member
Licensed User
Longtime User
Wow. I thought I was losing my mind. A fully functional app one day turns into programming nightmare.
Thanks!
 
Upvote 0
Top