Trying to take a photo using "cameraIntent" (with MediaStore.EXTRA_OUTPUT and a URI). To facilitate secure sharing by creating a content://uri instead of a file:///uri, and have secure permissions I use "FileProvider.getUriForFile" and this is returning "Failed to find configured root that contains "/CL-Shopping.jpg"
Here's the steps I have taken.
1. Android Manifest... (Inside the application tag of course)
2. From the above we need provider_paths...
(Here I have tried "external-path" AND "external-files-path" AND "files-path"
3. Then - I attempt to get the URI...
val fName = "CL-$lName-$item.jpg"
val dir = ""
val newFile = File(dir, fName)
val auth = BuildConfig.APPLICATION_ID + ".provider"
val fUri = FileProvider.getUriForFile(context!!, auth, newFile)
Breakpoint on the exception gives.
Failed to find configured root that contains /CL-Shopping-Potato Sticks.jpg
Obviously that's my filename and obviously it can't find the directory that
it's supposed to be in.
With a breakpoint on the getUriForFile, I can see that the variable "auth"
does have the application provider full name "com.example.missioncontroller.provider"
Please could anyone advise - thanks
What I have tried:
Have tried adding directory "files" which is seen as a directory under the com.example.missioncontroller directory...
Have tried several variants in the provider_paths file (all individually)