You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Jason Ginchereau (JIRA)" <ji...@apache.org> on 2016/03/02 00:33:18 UTC

[jira] [Commented] (CB-10425) Android External Storage directories not writable even with permissions

    [ https://issues.apache.org/jira/browse/CB-10425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15174623#comment-15174623 ] 

Jason Ginchereau commented on CB-10425:
---------------------------------------

Looking at the above code, there appears to be a mistaken assumption that the "root" of the persistent storage filesystem is going to be at "/", when actually it is something like "/data/data/<appid>/files/files". So, concatenating the externalApplicationStorageDirectory onto that yields a deep directory structure that doesn't exist. The NO_MODIFICATION_ALLOWED_ERR code is used whenever the target directory can't be created.

To fix this code, don't use the FS root, instead use resolveLocalFileSystemURL(cordova.file.externalApplicationStorageDirectory) to get the target directory entry.

> Android External Storage directories not writable even with permissions
> -----------------------------------------------------------------------
>
>                 Key: CB-10425
>                 URL: https://issues.apache.org/jira/browse/CB-10425
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin File
>         Environment: Phonegap using plugin cordova-plugin-dialogs
>            Reporter: Ryan Mark O'Connor
>              Labels: Android, triaged, wfc
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Using latest phonegap and cordova-plugin-dialogs, checked the following line is present in android xml:
> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
> Trying to execute the following code:
>     var dstDir = cordova.file.externalApplicationStorageDirectory.replace("file://", "");
>     directory.copyTo(root, dstDir, function() { alert('Export successful. Your exported photos can be found in ' + dstDir); }, errorHandler);
> The error handler is called with error code 6: FileError.NO_MODIFICATION_ALLOWED_ERR
> This also occurs if trying to use the external storage root as the destination directory. How can I get it to work? The value of dstDir on a real android tablet is:
>     /storage/emulated/0/Android/data/org.winston.photoarchiver/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org