Reputation: 2886
There's plenty of questions and answers how to work with the new API >= 19 permission model but I've been wondering about the opposite -- how I'm supposed to read file content from a Content Provider which has granted a read/write permission to my app and the device reboots for some reason?
Android documentations says:
ACTION_OPEN_DOCUMENT
is not intended to be a replacement forACTION_GET_CONTENT
. The one you should use depends on the needs of your app:Use
ACTION_GET_CONTENT
if you want your app to simply read/import data. With this approach, the app imports a copy of the data, such as an image file.Use
ACTION_OPEN_DOCUMENT
if you want your app to have long term, persistent access to documents owned by a document provider. An example would be a photo-editing app that lets users edit images stored in a document provider.
OK, so I have a photo-editing app running on API 16, what are my option to access (write to) this file? It seems very strange to ask the user to navigate to Gallery every single time he wants to continue his work, doesn't it? On the same token, making a copy in app's private folder doesn't seem like a good idea (think of big pictures/videos...)
Upvotes: 0
Views: 148
Reputation: 200080
There is no mechanism for persistent access to a URI across reboots prior to API 19 and the introduction of ACTION_OPEN_DOCUMENT - that was the exact reason the API was introduced.
You'll have to make a copy in your own storage space if you want to allow multiple editing sessions on the same item.
Upvotes: 3