117
Views
9
Comments
[Camera Plugin] After taking a picture the app crashes
camera-plugin
Mobile icon
Forge asset by OutSystems
Application Type
Mobile

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.0
These versions use the outsystems fork: 
https://github.com/OutSystems/cordova-plugin-camera#4.2.0-OS41
and 
https://github.com/OutSystems/cordova-plugin-camera#4.2.0-OS42

The devices that are reporting this issue (MABS9):
Redmi Note 11 -> Android 12
Samsung S21 FE -> Android 13

I 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/837
And 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 :) 

2019-06-23 20-19-45
Matheus Medeiros

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.

2024-12-02 12-15-17
Aravind EONE

Hi,

Can you try to change the MABS version to 8.1 and generate build?

2021-10-26 10-40-16
Gonçalo Tomás

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.1
Attached is a screen recording showing this issue.

IssueScreenRecording.mp4
2019-06-23 20-19-45
Matheus Medeiros

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).


UserImage.jpg
Abby Rafdi

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

2019-07-25 19-08-41
Amanda Stefani Campideli

Hi guys!

I'm also facing the same issue... any solution?

Thanks!


2019-06-23 20-19-45
Matheus Medeiros

Just an update.

I've opened a ticket and OutSystems have said:

  • Our R&D team is actively working on implementing an internal camera interface to prevent Android OS from killing the camera application.
  • As of today, our team does not have an expected date when this is going to be fully tested and implemented in the Camera Plugin.

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.

2019-07-25 19-08-41
Amanda Stefani Campideli

Hello guys!

Do you suggest any other Forge plugin with the same functionality but without this issue? 

Thanks!

UserImage.jpg
Hector Gordin

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?


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.