App is closed in background on using camera photo

Hello,
for some users, mostly IOS and some Android to, the data sent from camera photo are not received by the meteor app.
Context:
Existing meteor project using cordova-plugin-camera for 5 years.
Since last month many user start reporting that the can’t upload photo anymore, and the page is reloading after they take the photo.

From what I understand, when the camera photo is open, than app in background is closed by the device and reopen to the current url after camera is closed.
I could hardly reproduce the issue on my device, but the returned data from camera do not appear in the page, even if I try to store them in local-storage

I tried to replace DATA_URL by FILE_URI but the same behaviour is happening.

Does anyone reproduces this issue?

Thanks for your help

Do you user React?

Here is a sample of taking a photo. Is this how you do it?
What might happen if it worked but now it only works for some …

  • photos are too large
  • “new” phones process photos in HEIF and this might be incompatible with Cordova/Browser. I know HEIF are not supported by the browser and Cordova is technically a browser.
// .........
const [base64Image, setBase64Image] = useState(null)
const [cameraIsOpen, setCameraIsOpen] = useState(false)
// ......... 

const takeImage = () => {
    if (Meteor.isCordova) {
      CameraPreview?.takePicture({
        width: window.screen.width, height: window.screen.width, quality: 50
      }, imgData => {
        const img = 'data:image/jpeg;base64,' + imgData
        if (img) {
          setBase64Image(img)
        }
        CameraPreview?.stopCamera()
        setCameraIsOpen(false)
      })
    } else {
      console.log('take a photo')
    }
  }

Hello,
thanks for your answer. I think you speak about an another plugin? What I use is GitHub - apache/cordova-plugin-camera: Apache Cordova Plugin camera

Sorry, I assumed you were still asking about the same topic of your other post: [Solved] How to import cordova-plugin-camera-preview - #17 by sidae

No problem :grinning:
Indeed I tried, without success, to switch to camera-preview as a solution to this issue.