New KitKat URIs dont respond to Intent.ACTION_VIEW

后端 未结 2 630
不知归路
不知归路 2021-02-14 00:38

Since KitKat has changed the URIs from pickers to likes of

 content://com.android.providers.media.documents/document/image:3951

then none of my

2条回答
  •  被撕碎了的回忆
    2021-02-14 01:29

    The solution is to pass the flag FLAG_GRANT_READ_URI_PERMISSION to the intent (on KitKat and above):

    intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    

    Also make sure that this content Uri was retrieved from an ACTION_OPEN_DOCUMENT intent as described here: https://stackoverflow.com/a/19874645/334209

提交回复
热议问题