I am not able to open file picker in android 10 and showing toast Failed to create image file...but working fine in android 9.
-
can you show your code ?niceumang– niceumang2020-01-17 12:56:04 +00:00Commented Jan 17, 2020 at 12:56
-
we're going to need some code to be able to help you.Nikos Hidalgo– Nikos Hidalgo2020-01-17 12:56:09 +00:00Commented Jan 17, 2020 at 12:56
-
@androidkumar , I am also facing same issue .Can u please answer if it is solved .Vivek Patel– Vivek Patel2021-02-26 13:23:11 +00:00Commented Feb 26, 2021 at 13:23
-
You must use app directory to store the File. Remove the Relative access Path.Beatle Refractor– Beatle Refractor2021-03-11 15:52:54 +00:00Commented Mar 11, 2021 at 15:52
1 Answer
Because Google have made file paths outside of the App's private directories useless with their scoped storage changes in Android 10, as the picture is of a non standard file picker, I guess it has not been updated (or deprecated as you can do a lot with the builtin stuff)
See https://developer.android.com/training/data-storage
Depending on the types of files you need to use MediaStore or Storage Access Framework (SAF), details https://developer.android.com/training/data-storage/shared for files outside of your App's private directories.
As it looks like picking photos, you might be able to use Google photo app to pick.
Though as a quick fix is to temporarily opt out https://developer.android.com/training/data-storage/compatibility but this will only work until Android 11