imagine i'm openeing file using standard intent.action_open_document this
intent intent = new intent(intent.action_open_document); intent.settype("text/plain"); ... startactivityforresult(intent, read_request_code);
which performs expected.
in files content, file name mentioned open without user interaction (just exchange file name of intend result 1 read file). doing this, i'll java.lang.securityexception: permission denial: reading com.android.externalstorage.externalstorageprovider uri content://com.android.externalstorage.documents/document/primary%3adownload%2finc.txt pid=..., uid=... requires android.permission.manage_documents, or granturipermission()
calling getcontentresolver().openinputstream(manipulateduri)
weird in androidmanifest.xml
written follows:
<uses-permission android:name="android.permission.read_external_storage" /> <uses-permission android:name="android.permission.manage_documents" />
what makes more weird me following: file includes file name b. if open way, not work. but, openening file b first (making known systems contentresolver instance?) , afterwards openening file a, programatic load of file b works expected after app restart.
does knows reason such behavior?
api level 19 used
in file, file name mentioned
i going assume mean "a string
representation of uri
". uri
not file.
which weird in androidmanifest.xml written follows:
manage_documents
signature
permission, meaning app has signed same signing key signed firmware, in order hold permission. likely, not case app.
what makes more weird is, if open file loaded programatically first , afterwards loading via inclusion, works.
it unclear mean this.
a uri
not file. uri
contentprovider
more closely resembles url web site, url requires authentication. persisting url not useful, while might able access content identified url (given user has done authentication site), might not able access content identified url tomorrow.
in case of action_open_document
, have access content identified uri
until process terminates. exception if storage provider offers persistable uri
permissions and call takepersistableuripermission()
on contentresolver
once first uri
via action_open_document
. then, might not have indefinite access (e.g., user deletes file).
Comments
Post a Comment