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

ASF GitHub Bot commented on CB-11142:
-------------------------------------

Github user riknoll commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-file/pull/179#discussion_r60990249
  
    --- Diff: README.md ---
    @@ -273,6 +273,15 @@ Listing asset directories is really slow on Android. 
You can speed it up though,
     adding `src/android/build-extras.gradle` to the root of your android 
project (also
     requires [email protected] or greater).
     
    +### Permisson to write to external storage when it's not mounted
    +
    +Marshmallow requires the apps to ask for permissions when reading/writing 
to external locations. By default, your app has permission to write to
    +`cordova.file.applicationStorageDirectory` and 
`cordova.file.externalApplicationStorageDirectory`, with the latter becoming 
available when the external storage 
    +is mounted and available to use. When the external storage is mounted, the 
plugin would check if the path of the file being handled falls within these 
    +directories and would ask for permission if it's not so. However when the 
external storage is not mounted, 
`cordova.file.externalApplicationStorageDirectory` 
    +is not available and the plugin would only be able to check the file path 
wrt `cordova.file.applicationStorageDirectory`. So if your app tries to write 
to 
    +externalApplicationStorageDirectory when the external storage is not 
mounted, the plugin would still ask for permission and then fail since that 
path is not available.
    --- End diff --
    
    Don't bother explaining why it fails. Just state the behavior and say that 
it is "due to a limitation in Android". That is, we never request runtime 
permission for those two directories unless external storage is not mounted. 
Also, clarify that this is only on Marshmallow.


> Fix the NeedPermission code for the case when external media is not mounted 
> in Android
> --------------------------------------------------------------------------------------
>
>                 Key: CB-11142
>                 URL: https://issues.apache.org/jira/browse/CB-11142
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin File
>            Reporter: Raghav Katyal
>            Assignee: Raghav Katyal
>              Labels: Android
>
> Line 582 in FileUtils.java has:
> String[] allowedStorageDirectories = 
> {j.getString("applicationStorageDirectory"), 
> j.getString("externalApplicationStorageDirectory")};
> This would cause an JSON exception when "externalApplicationStorageDirectory" 
> is not present, which happens when the external storage is not mounted in the 
> device/emulator. 



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to