breautek commented on issue #917:
URL: 
https://github.com/apache/cordova-plugin-camera/issues/917#issuecomment-2463114760

   I'm pretty confident the "crash" is a red herring. It might be triggering 
the crash callback from the OS killing the activity, even though that's an 
expected behaviour when working with intents.
   
   While using an intent it's not guaranteed for the app to stop but the OS 
reserves the right to kill it if it deems it necessary. If you enable the 
developer options on Android, you can enable the `Don't Keep Activities` option 
which will skip whatever logic Android has and always kill the activity when 
the OS switches to another activity. In android, `activity` basically refers to 
an application.
   
   I glanced through the logs and I see:
   
   ```
   {
         "header": {
           "logLevel": "DEBUG",
           "pid": 17356,
           "tid": 17356,
           "applicationId": "com.xxx.xxx",
           "processName": "com.xxx.xxx",
           "tag": "CordovaActivity",
           "timestamp": {
             "seconds": 1730989421,
             "nanos": 918000000
           }
         },
         "message": "Stopped the activity."
       },
   ```
   
   Note the timestamp: 1730989421
   
   Few seconds later:
   
   ```
   {
         "header": {
           "logLevel": "ERROR",
           "pid": 17356,
           "tid": 17356,
           "applicationId": "com.xxx.xxx",
           "processName": "com.xxx.xxx",
           "tag": "WebviewCrashesHandler",
           "timestamp": {
             "seconds": 1730989427,
             "nanos": 360000000
           }
         },
         "message": "La Webview a été tuée par le système"
       },
   ```
   
   We see this, but this is to be expected since the activity is stopped and/or 
stopping.
   
   Fast forward a bit:
   
   ```
   {
         "header": {
           "logLevel": "DEBUG",
           "pid": 17356,
           "tid": 17530,
           "applicationId": "com.xxx.xxx",
           "processName": "com.xxx.xxx",
           "tag": "SERVER",
           "timestamp": {
             "seconds": 1730989427,
             "nanos": 477000000
           }
         },
         "message": "Handling local request: https://kwap/index.html#/home";
       },
   ```
   
   here the activity has restarted, since the webview is requesting presumably 
your home/content src page.
   
   It's a bit hard to visualise what the app is doing from the logcat logs but 
I suspect that after the picture is taken and accepted, the app does come back 
to the Cordova webview view, just that perhaps your state has been reset? If so 
then that's the activity being killed and recreated when the camera's activity 
is done, and the `resume` event should have the camera result stored in the 
resume event.
   
   ```js
   window.document.addEventListener('resume', (e) => {
       console.log(e.pendingResult);
   });
   ```
   
   Again this flow can be tested when using the `"Don't Keep Activities"` 
developer option in the Android developer settings


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to