El-Tommy opened a new issue, #820:
URL: https://github.com/apache/cordova-plugin-camera/issues/820
Until a few months ago, Motorola users with Android 11 and Android 12 were
able to open the camera and take pictures, but recently this feature stopped
working.
Users with Motorola devices running Android 10 or below can still take
pictures, and users with Samsung devices running Android 11+ can also take
photos.
Is there something wrong with my code or config.xml? Or did something change
in Android 12 that requires changes to cordova and plugin request mode?
These are the settings I have since the last update of my app:
**package.json**
```
"dependencies": {
"cordova-android": "^8.1.0",
"cordova-ios": "^5.1.1",
"cordova-plugin-androidx": "^1.0.2",
"cordova-plugin-androidx-adapter": "^1.1.0",
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-dialogs": "^2.0.1",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-file-transfer": "^1.7.1",
"cordova-plugin-filechooser": "^1.2.0",
"cordova-plugin-filepicker": "^1.1.6",
"cordova-plugin-firebasex": "^6.0.2",
"cordova-plugin-inappbrowser": "^3.0.0",
"cordova-plugin-media": "^5.0.2",
"cordova-plugin-media-capture": "^3.0.2",
"cordova-plugin-network-information": "^2.0.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-vibration": "^3.1.0",
"cordova-plugin-whitelist": "^1.3.3",
"ionic-plugin-keyboard": "^2.2.1"
},
"devDependencies": {
"cordova-plugin-whitelist": "1",
"xcode": "^2.0.0"
},
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-camera": {},
"cordova-plugin-device": {},
"cordova-plugin-dialogs": {},
"cordova-plugin-filechooser": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-network-information": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-vibration": {},
"cordova-plugin-file": {},
"cordova-plugin-file-transfer": {},
"cordova-plugin-media": {
"KEEP_AVAUDIOSESSION_ALWAYS_ACTIVE": "NO"
},
"cordova-plugin-media-capture": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-filepicker": {},
"cordova-plugin-androidx": {},
"cordova-plugin-androidx-adapter": {},
"cordova-plugin-firebasex": {}
},
"platforms": [
"ios",
"android"
]
}
```
**config.xml**
```
<platform name="android">
<edit-config file="AndroidManifest.xml" mode="merge"
target="/manifest/application">
<application android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round" />
</edit-config>
<resource-file
src="res/android/adaptiveicon/drawable/ic_launcher_background.xml"
target="app/src/main/res/drawable/ic_launcher_background.xml" />
<!-- More Resources Files -->
<resource-file
src="res/android/adaptiveicon/mipmap-xxxhdpi/ic_launcher_round.png"
target="app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png" />
<splash density="land-ldpi"
src="res/android/splash/drawable-land-ldpi-screen.png" />
<!-- More Splashs -->
<splash density="port-xxxhdpi"
src="res/android/splash/drawable-port-xxxhdpi-screen.png" />
<resource-file
src="res/android/notification/drawable-anydpi/ic_notification.xml"
target="app/src/main/res/drawable-anydpi/ic_notification.xml" />
<!-- More Resources Files -->
<resource-file
src="res/android/notification/drawable-xxhdpi/ic_notification.png"
target="app/src/main/res/drawable-xxhdpi/ic_notification.png" />
<config-file parent="/manifest/application" target="AndroidManifest.xml">
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notification" />
</config-file>
<allow-intent href="market:*" />
</platform>
<preference name="permissions" value="none" />
<preference name="orientation" value="default" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="false" />
<preference name="webviewbounce" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="false" />
<preference name="detect-data-types" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="disable-cursor" value="false" />
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="30" />
<preference name="android-installLocation" value="auto" />
<preference name="phonegap-version" value="cli-6.4.0" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
```
Function in JS that opens the camera
```
function openCameraAndroid() {
var srcType = Camera.PictureSourceType.CAMERA,
options = setOptionsCamera(srcType);
navigator.camera.getPicture(function cameraSuccess(imageUri) {
$scope.selectFileAndUpload({ url: imageUri });
}, function cameraError(error) {
console.debug("Unable to obtain picture: " + error, "app");
}, options);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]