apache / apache/cordova-plugin-camera

Android 12, moto g42 getPicture not response, no error

Open
#859 13 comments 0 reactions 0 assignees View on GitHub
Dominant language
Objective-C
Stars
976
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

# Bug Report

## Problem
On android 12 (moto g42) `getPicture` method do nothing. Nothing happens. Nothing shows up. The method returns neither an error nor a success. The phone doesn't freeze. Just tap on my button and nothing happens. The promise is not fulfilled.

LogCat shows only this:

`To native (Cordova plugin): callbackId: Camera936725130, service: Camera, action: takePicture, actionArgs: [90,0,1,-1,400,0,0,false,true,false,null,0]`

I have 2 other phones with android 12, and some phones with androids 9, 10, 11, 13 and everything works fine on them on the same app. I tried repeatedly to install the application, clear data, etc.

### What is expected to happen?
The camera should open

### What does actually happen?
Nothing

## Information
- The problem only appears on my moto g42 (android 12)
- I made sure that the camera on the phone works separately
- Everything works fine on my other phones:
-- 2 other phones with android 12 (Samsung s10, Oppo A54 5g)
-- Some other phones with android: 9, 10, 11, 13

### Command or Code
```
const options: CameraOptions = {
quality: 90,
allowEdit: false,
destinationType: this.camera.DestinationType.FILE_URI,
encodingType: this.camera.EncodingType.JPEG,
sourceType: pictureSourceType,
mediaType: this.camera.MediaType.PICTURE,
correctOrientation: true,
};
this.camera.getPicture(options).then((imageData) => {
// the code does not execute here
...
, (err) => {
// the code here also doesn't execute
}
```

### Environment, Platform, Device
- Android
- Api target 33
- cordova-plugin-camera: 7.0.0
- Ionic 7.1.0

## Checklist

- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue on the moto g42 with Android 12, then trace the JavaScript getPicture call to the native takePicture entry point while watching LogCat. Done means the camera opens and the promise resolves or rejects instead of remaining pending.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, javascript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.