Jean Carriere created CB-5401:
---------------------------------

             Summary: Plugin File Transfer does not work on Android 4.4
                 Key: CB-5401
                 URL: https://issues.apache.org/jira/browse/CB-5401
             Project: Apache Cordova
          Issue Type: Bug
          Components: Android, Plugin File Transfer
    Affects Versions: 3.4.0
            Reporter: Jean Carriere


When using FileTransfer plugin to upload a file, I get an error on KitKat (the 
code works fine on android 4.3.
Here is the stack trace : 
java.lang.SecurityException: Permission Denial: reading 
com.android.providers.media.MediaDocumentsProvider uri 
content://com.android.providers.media.documents/document/image:5646 from 
pid=16183, uid=10093 requires android.permission.MANAGE_DOCUMENTS, or 
grantUriPermission()
E/FileTransfer(16183):  at android.os.Parcel.readException(Parcel.java:1461)
E/FileTransfer(16183):  at 
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
E/FileTransfer(16183):  at 
android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:148)
E/FileTransfer(16183):  at 
android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:682)
E/FileTransfer(16183):  at 
android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1063)
E/FileTransfer(16183):  at 
android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:904)
E/FileTransfer(16183):  at 
android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:831)
E/FileTransfer(16183):  at 
org.apache.cordova.CordovaResourceApi.openForRead(CordovaResourceApi.java:245)
E/FileTransfer(16183):  at 
org.apache.cordova.CordovaResourceApi.openForRead(CordovaResourceApi.java:204)
E/FileTransfer(16183):  at 
org.apache.cordova.filetransfer.FileTransfer$1.run(FileTransfer.java:364)
E/FileTransfer(16183):  at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/FileTransfer(16183):  at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/FileTransfer(16183):  at java.lang.Thread.run(Thread.java:841)

The js code is : 
 var options = new FileUploadOptions();
            options.fileKey = "file";
            options.fileName = imageURI.substr(imageURI.lastIndexOf('/') + 1);
            options.mimeType = "image/jpeg";
            options.headers = {
                Connection: "close"
            };
            options.chunkedMode = false;
            var params = {};
            params.token = config.token();
            options.params = params;
            var ft = new FileTransfer();
            ft.upload(imageURI, config.serviceUrl() + "media/default", win, 
fail, options);




--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to