Hyndrix
Hyndrix

Reputation: 4452

Persistable permissions for content uri received via onNewIntent

I want to gain persistent read access to files received via onNewIntent():

public void onNewIntent(Intent intent) {
    Uri uri = getIntent().getData();
    getContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); // fails
}

But this fails because takePersistableUriPermission is intended to be used with ACTION_OPEN_DOCUMENT (from the Storage Access Framework):

System.err: java.lang.SecurityException: No persistable permission grants found for UID 10222 and Uri content://...

Is there a way to get persistent read permission for files received via onNewIntent()? Or do I have to copy the file to the local app directory?

Regards,

Upvotes: 0

Views: 264

Answers (0)

Related Questions