File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
imagepicker/src/main/kotlin/com/github/drjacky/imagepicker/util Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -60,8 +60,15 @@ Where `$libVersion`
6060 if (it.resultCode == Activity .RESULT_OK ) {
6161 val uri = it.data?.data!!
6262 // Use the uri to load the image
63- }
64- }
63+ // Only if you are not using crop feature:
64+ uri?.let { galleryUri ->
65+ contentResolver.takePersistableUriPermission(
66+ uri, Intent .FLAG_GRANT_READ_URI_PERMISSION
67+ )
68+ }
69+ // ////////////
70+ }
71+ }
6572```
6673
6774** Java**
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ object IntentUtils {
4141 */
4242 private fun getGalleryDocumentIntent (mimeTypes : Array <String >): Intent {
4343 // Show Document Intent
44- val intent = Intent (Intent .ACTION_OPEN_DOCUMENT ).applyImageTypes(mimeTypes)
44+ val intent = Intent (Intent .ACTION_GET_CONTENT ).applyImageTypes(mimeTypes)
4545 intent.addCategory(Intent .CATEGORY_OPENABLE )
4646 intent.addFlags(Intent .FLAG_GRANT_PERSISTABLE_URI_PERMISSION )
4747 intent.addFlags(Intent .FLAG_GRANT_READ_URI_PERMISSION )
You can’t perform that action at this time.
0 commit comments