[BUG] Camera button does not work for devices targeting Android 11
NickalasB opened this issue · 5 comments
Describe the bug
The camera button is unresponsive on devices targeting Android 11 (API 30).
To Reproduce
Steps to reproduce the behavior:
- Update the
targetSdk
andcompileSdk
to 30 in the sample app - Address the compile errors around
arrayLists
- path = data!!.getParcelableArrayListExtra(FishBun.INTENT_PATH)
+ path = data?.getParcelableArrayListExtra(FishBun.INTENT_PATH) ?: arrayListOf()
- Launch the sample app
- Click on
ACTIVITY IN STARTACTIVITYFORRESULT(DARK)
- Click the
+
button - Click an album
- Click on the camera
Expected behavior
The device should ask for camera permission and then launch the camera, where the user can take a photo that will be added to the selected album.
Screenshots
If applicable, add screenshots to help explain your problem.
Smartphone (please complete the following information):
- Device: [Pixel3]
- OS: [Android 11]
Browser [e.g. stock browser, safari]Version [e.g. 22]
Additional context
This issue was actually exposed when trying to upgrade our Flutter app that uses the Flutter multi_image_picker plugin.
When will we get update please? Can not launch camera on API level 30.
Same issue here.
Add this in your AndroidManifest.xml
android:requestLegacyExternalStorage="true" in application tag
thanks
based on https://stackoverflow.com/a/64204646/908821
add the following to your manifest
<queries>
<!-- Camera -->
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
</queries>