Some users of our application are reporting that after taking a picture the app crashes and restarts.This issue happens in both versions of the forge camera plugin: 7.2.0 and 7.3.0These versions use the outsystems fork: https://github.com/OutSystems/cordova-plugin-camera#4.2.0-OS41and https://github.com/OutSystems/cordova-plugin-camera#4.2.0-OS42The devices that are reporting this issue (MABS9):Redmi Note 11 -> Android 12Samsung S21 FE -> Android 13I was also able to replicate this issue by enabling "Don't keep activities" under developer options on android. Used the demo application provided in forge with our test device that is a Samsung A52s running android 13. The app restarts after taking the picture.This issue is also present in the original fork:https://github.com/apache/cordova-plugin-camera/issues/837And it is also noted to be a issue referred in the documentation:https://github.com/apache/cordova-plugin-camera/blob/master/README.md#android-quirks(Under the section: "Android Quirks")The configurations of the "Take Picture" action are:Important to note that we are not saving the picture to the device internal storage, indicating that this might be the issue.Since this is a supported component of outsystems could I have some assistance solving this issue?Thank you very much :)
I'm the author of the issue in the cordova repo.
I've manually created a cordova app and installed the cordova plugin, and the resume event work as documented.
So my guess is that something in the OutSystems implementation is breaking the plugin.
Hi,
Can you try to change the MABS version to 8.1 and generate build?
Hi,@aravind mani Tested with the mabs 8.1 and the issue remained, I was also using the version 7.3.0 of the forge component with the mabs 8.1Attached is a screen recording showing this issue.
Just to clarify, the crash by it self it not the issue.
The main problem is that, acording to cordova documentation, we should subscribe to the "resume" event, to get the taken photo before the crash.
https://cordova.apache.org/docs/en/dev/guide/platforms/android/index.html#example
I've created an cordova app from scratch, and the "resume" was triggered just like documented, with the photo in the "event.pendingResult.result" variable.
In the OutSystems implementation, the "resume" event never gets triggered if the photo is taken (if the photo is canceled, the event is triggered correctly).
So i assume that something in the OutSystems implementation of the plugin is causing the event not to be triggered.
I've enabled "Don't keep activities" settings from android, in order to simulate the issue (as recomended by the cordova team Cordova docs).
I've got several users unable to use the apps camera capabilities because of this issue (mainly Xiaomi users).
Hi @Matheus Medeiros, Is any update for this issue? or have you solve it? i have the same problem recently, on some device that have low RAM available especially in device using MIUI the app always keep restarting after taking picture
Hi guys!
I'm also facing the same issue... any solution?
Thanks!
Just an update.
I've opened a ticket and OutSystems have said:
I've just like to reiterate, because people think that the app is "crashing". It isn't. The app activity is been destroyed, and this is part of Android's life cycle system. It is not an error.
The main problem here is that once the user takes the photo and the activity gets recreated, we should be able subscribe to the 'resume' event from Cordova and recover the photo, but in OutSystems implementation of the plugin, the photo never gets returned for some reason.
PS.: Their response of "implementing an internal camera interface" is a terrible idea, and my ropes that this issue will ever get fixed is very low.
Hello guys!
Do you suggest any other Forge plugin with the same functionality but without this issue?
Hello Everyone,
The root cause of this issue lies in the Android system's mechanism to free up resources when the device is low on memory. It does so by killing background activities, including the Cordova activity running your application. Consequently, any state maintained by your application gets lost. When the user navigates back, the OS recreates the activity and WebView, but it doesn't automatically restore the application state. This issue becomes especially significant when other activities are launched by plugins (such as the camera plugin), which can push the Cordova activity into the background, thereby increasing the chances of it being terminated by the OS.
Please note that this issue isn't related to the Camera Plugin itself, as explained earlier.
We are actively investigating potential solutions to this problem. To assist us in this process, could you let us know if you've experienced this issue less frequently with previous versions of the plugin, such as 7.1.14 or lower?