Bitmap decode on the image file path returned by TakePhoto ( reproducible only on Android 11 )
aquakul opened this issue · 1 comments
Version Number of Plugin: 4.0.1.5
Device Tested On: Samsung Galaxy S20
Simulator Tested On: NA
Version of VS: MS VS 2019 Enterprise 16.8.3
Version of Xamarin: Xamarin Android 9
Versions of other things you are using: Android OS 11
Steps To reproduce -
- Launch Camera using Mediapicker.TakePhotoAsync()
- Click a photo and return to App.
Actual Behavior - Cannot read bitmap from the path returned by Mediapicker.TakePhotoAsync()
The API used to decode the bitmap at the path is - BitmapFactory.DecodeFile(/**/)
Expected behavior - Failed to load bitmap from the path. BitmapFactory.DecodeFile(/**/) returns null.
Code Snippet -
var opts = new StoreCameraMediaOptions
{
Name = "TestImage",
Directory = "TestImages"
};
var camera = new MediaPicker(/* Android Activity instance*/);
MediaFile file = await camera.TakePhotoAsync(opts);
var b = BitmapFactory.DecodeFile(file.Path);
// The above function call returns null and the following error is seen on logs
// Failed to create image decoder with message 'unimplemented'
PS - This issue is noticed only on Android devices running on Android 11. Have not yet tried with the latest Plugin version as it needs the migration to Android X.
Please upgrade to latest beta and androidx