android - How to grant URI permission in PhoneGap build app? -
environment: cross-platform app i've worked on. did not build it. it's 5 years old. targets: android 4.4 , above, ios not limited. i'm developing on mac, using phonegap build- 3.7.0. getting error on android emulator- api 23 , 19.
i trying access imageuri check file size. filetransfer
limit 10 mb. here code that:
resolvelocalfilesystemuri(this.pagecontainer.items.items[0].imageuri, function(fileentry){ fileentry.file(function(fileobj){ if (maxsize <= fileobj.size){ ext.msg.alert("error", "chosen image large. submit different image."); return; } else { ext.msg.alert("you here:", "file size accepted "+ fileobj.size); } }) })
problem it's unable down past resolvelocalfilesystemuri
. adb log says:
e databaseutils: java.lang.securityexception: permission denial: reading com.android.externalstorage.externalstorageprovider uri content://com.android.externalstorage.documents/document/1a03- 3b0b%3adcim/camera/elevation.jpg pid=2921, uid=10080 requires android.permission.manage_documents, or granturipermission()
i know can add permission androidmanifest, , go there, using phonegap build 3.7.0. have edit config.xml
, using these settings:
<plugin name="org.apache.cordova.camera" source="pgb" spec="0.3.2" /> <plugin name="org.apache.cordova.device" source="pgb" spec="0.2.12" /> <plugin name="org.apache.cordova.file" source="pgb" spec="1.3.3" /> <plugin name="org.apache.cordova.file-transfer" source="pgb" spec="0.5.0" /> <plugin name="org.apache.cordova.geolocation" source="pgb" spec="0.3.10" /> <plugin name="org.apache.cordova.network-information" source="pgb" spec="0.2.12" /> <preference name="phonegap-version" value="3.7.0" /> <preference name="android-minsdkversion" value="19" /> <preference name="orientation" value="portrait" /> <preference name="target-device" value="universal" /> <preference name="fullscreen" value="true" /> <preference name="prerendered-icon" value="false" /> <feature name="http://api.phonegap.com/1.0/network" /> <feature name="http://api.phonegap.com/1.0/camera" /> <feature name="http://api.phonegap.com/1.0/geolocation" /> <feature name="http://api.phonegap.com/1.0/media" /> <feature name="http://api.phonegap.com/1.0/contacts" /> <feature name="http://api.phonegap.com/1.0/file" /> <feature name="http://api.phonegap.com/1.0/device" />
previously, did not include <feature>
, in attempt remidiate added config.xml resulted in no change in behavior. need add config.xml
same manage_documents?
the solution upgrade phonegap build version cli-5.2.0 (among other versions, i'm sure). build old support granting android access file when coupled android target of 19+.
Comments
Post a Comment