Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 12306 [details]
XM Changed files
Customer filed an issue on github for this bug: https://github.com/xamarin/Xamarin.Mobile/issues/48
"With Android 5.1.1, only the Activity that launches the photo library intent has permission to read the content:// Uri that it returns when a user selects a photo. Since the MediaPicker component has an internal MediaPickerActivity that actually launches the photo library intent instead of the calling app, only the MediaPickerActivity can read the Uri. Currently, MediaPickerActivity just forwards the content Uri back to the calling app which results in a security exception on Android 5.1.1.
My proposal is to change the GetPickPhotoUI method to accept options just like the GetTakePhotoUI does. The user can pass in a Name and Directory where he wants the selected photo to be copied to. Then when the MediaPickerActivity receives the content Uri, it can read that Uri (since it is the only thing that has permission to do so) and copy it to the user specified file path. Then that file path is returned back to the calling app Activity."
## Steps to reproduce:
1. Download and open the MediaPickerSample project from the Xamarin.Mobile component github:
Or just create a new Android app project and install the Xamarin.Mobile component and open the Android sample.
2. Launch the MediaPicker Sample project to a lollipop device that has the Google Photos app installed.
3. Click the "Pick Photo" button.
4. Choose "Photos" as the app to pick a photo from.
5. Select a photo from the Photos folder (other folders seem to work ok)
Expected result: MediaPickerSample app will resume and display the photo in a new activity.
Actual result: MediaPickerSample app resumes but does not launch the activity to display the photo.
Customer has modified the Xamarin.Mobile source code to implement his suggestions in the description above.
Customer described a Java.Lang.SecurityException that he received that I did not while testing, but this was due to his wrapping a try/catch around the offending code in the Xamarin.Mobile source while I was just using the prebuilt .dll for Xamarin.Mobile.
I have attached the three files that have the modifications suggested by the customer as a private attachment. The changes in those files resolve this issue for the customer, but he is unsure if his is the best approach.
I have been told that the fix is already in master.
We have a PR merged already that takes care of this: https://github.com/xamarin/Xamarin.Mobile/pull/49
Will be in the next Xamarin.Mobile component release!
This was released some time ago, closing issue.