Storage Access Framework to select where to create the file Open URI for writing using ContentResolver.openOutputStream() or ContentResolver.openFileDescriptor() Supports persisting URI permissions
FileProvider) FLAG_GRANT_READ_URI_PERMISSION grants receiving app permission to access this Uri But URI permissions weren’t well understood in the early days -> People used file:// URIs :(
and clipData fields of an Intent Framework contains special handling for ACTION_SEND: Copies contents of EXTRA_STREAM extra to clipData field ClipData is API 16+ Workaround <API 16: Set data field to value of EXTRA_STREAM extra
only have permission to access the content as long as the receiving component (usually Activity) is alive Permission grant can be passed on to other components, also other apps -> Intent + FLAG_GRANT_READ_URI_PERMISSION
to Same issues as ACTION_SEND; URI permissions don’t apply to EXTRA_OUTPUT Framework only added special handling for this with API 21 Workaround: Set data and/or clipData field to content: URI
maxSdkVersion=”18” ACTION_GET_CONTENT no* ACTION_*_DOCUMENT no Sending files with ACTION_SEND no Receiving files no* * If you want to support misbehaving apps: maxSdkVersion=”22”