Open Lerolben opened 1 year ago
Hello i'm with the problem "No image Selected" after update the cordova for 12.0.1 e cordova-plugin-camera: 7.0.0 and my camera sometimes dont works. Did you have this problem ?
I have users reporting the same or similar issue on a Galaxy S23. I am unable to reproduce the problem myself on an older galaxy
Following the thread here: https://github.com/apache/cordova-plugin-camera/issues/826, I installed this fork: https://github.com/jalios/cordova-plugin-camera/
And my problem was solved. The problem appears to be related to new permission requirements on the latest Android, so older versions do not have the problem.
(v7 of the standard apache/cordova-plugin-camera apparently also fixes the problem, but I was unable to use it because I am fixing a very old app on ionic v1 which is pinned to android 10, which is too old for this plugin, but the jalios plugin was able to work for me.)
@viking2917 I have the latest version of the plugin, which works well on many of my phones running all versions of Android (8, 9, 10, 11, 12, 13). The problem only appears on Motorola G42 with Android 12. I don't know if it's a problem with this specific phone or Motorola G42 in general. Please let me know if any of you have a G42 with Android 12 and this plugin works for you.
Sorry I do not have a that device :(
On Sat, Oct 7, 2023 at 9:23 PM Lerolben @.***> wrote:
@viking2917 https://github.com/viking2917 I have the latest version of the plugin, which works well on many of my phones running all versions of Android (8, 9, 10, 11, 12, 13). The problem only appears on Motorola G42 with Android 12. I don't know if it's a problem with this specific phone or Motorola G42 in general. Please let me know if any of you have a G42 with Android 12 and this plugin works for you.
— Reply to this email directly, view it on GitHub https://github.com/apache/cordova-plugin-camera/issues/859#issuecomment-1751946706, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2VYVJKQN35FMSZBZPM6XDX6JIGJAVCNFSM6AAAAAA5MPHDTOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJRHE2DMNZQGY . You are receiving this because you were mentioned.Message ID: @.***>
@Lerolben We are having the same problem using the latest version of the plugin. Any news on your side?
The device is a Motorola g51 5G in our case. When the device was with Android 11, the pictures were captured without problems, but after the device was updated to Android 12, it works only sometimes. From 10 attempts, only 2 finished successfully.
What happens is that after pressing the camera icon (to open camera), most of the time the app shows a white screen and fully reloads the app, so the app home screen is shown. No useful logs are shown in logcat.
We have set the CameraOptions quality setting to 70 to try to minimize memory usage, but it doesn't seam to be this problem since the device has enough memory, and older devices, with far less memory, are working OK.
We're also using the latest versions ATM of these plugins: "cordova-plugin-camera": "7.0.0", "cordova-plugin-file": "8.0.0", "cordova-plugin-media": "7.0.0",
These are the devices/emulators we have verified the app is working OK: Samsung J5 (Android 9.0) Xiaomi Redmi 10 (Android 11) Samsung A13 (Android 13) Samsung XCover 5 (Android 13) Emulator (Android 12) Emulator (Android 12L)
Sadly, we don't have another Android 12 device to try at the moment…
We found this:
The Android OS may kill activities that are in the background to preserve memory, particularly if the foreground activity requires a lot of memory. When you use the Camera App, it puts your app into the background.
This is documented here:
Android uses intents to launch the camera activity on the device to capture images, and on phones with low memory, the Cordova activity may be killed. In this scenario, the result from the plugin call will be delivered via the resume event. See the Android Lifecycle guide for more information. The pendingResult.result value will contain the value that would be passed to the callbacks (either the URI/URL or an error message). Check the pendingResult.pluginStatus to determine whether or not the call was successful.
We're not sure if maybe that pendingResult.result is what we need to handle to recover the picture data…
@rideo-eduardmorales Unfortunately, I still haven't found a solution to the problem. In my case the application does not restart. The plugin simply doesn't give any feedback.
Maybe plugin developers should check pendingResult.result
and what you wrote.
Hello, for me the 'same' probleme with motorola g51. My app crash from plugin after capture picture and restart. Anyone have the same probleme?
Beside I have an user experience on motorola g9, the app crash with plugin camera and the phone doesn't restart. He has to plug the phone into power outlet. Anyone have the same probleme?
using background plugin.
The error occurs when you have to exit the app to take a photo and then when you return. I recommend using the background plugin so that when you go to take a photo, you put the app in background mode and when you return, you remove it.
If the activity gets killed during getPicture
call (while the camera application is open), it's callback won't get called.
When the activity gets reloaded it requires reconstructing the webview, which means your web app will also be re-loaded. The JS state is not restored.
The response will be available inside the resume
event however.
This is likely the case. You can forcefully test this case by enabling developer options on the android device and then enable the Don't Keep Activities
option in the Developer settings. With this enabled, the OS will always kill the activity when the Camera intent starts, allowing you to test the that quirk. It's part of normal android behaviour, so it's something that developers are expected to handle.
This bug report sounds like this is the situation. @Lerolben were you able to confirm this?
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
Command or Code
Environment, Platform, Device
Checklist