Android: Read a file without external storage permission -
i don't want app require permissions, want user able select file reading. app doesn't need arbitrary access filesystem. however, openfiledialog implementations have researched far seem assume permission access external storage.
one workaround can think of configure app among list of apps open type of file. haven't tried this, hope work without permission access external storage. however, user guidance less ideal in case. prefer solution dialog , have user pick file.
i think requirement not undermine security, because user has full control on file app can read. possible somehow?
however, openfiledialog implementations have researched far seem assume permission access external storage.
set minsdkversion
19, use action_open_document
, part of the storage access framework.
or, if need minsdkversion
below 19, use action_get_content
on older devices.
you uri
via onactivityresult()
. use contentresolver
, methods openinputstream()
consume content identified uri
.
i haven't tried this, hope work without permission access external storage
only if exclude file:
uri
values. example, <intent-filter>
supports content:
uri
values work.
Comments
Post a Comment