You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/08/30 14:59:56 UTC

[GitHub] [cordova-plugin-camera] willemjanvankranenburg opened a new issue #758: Ionic app sometimes restarts after taking a picture

willemjanvankranenburg opened a new issue #758:
URL: https://github.com/apache/cordova-plugin-camera/issues/758


   # Bug Report
   
   ## Problem
   
   ### What is expected to happen?
   I expect my Ionic app to still be runing and getting the correct result when taking a picture using the camera plugin.  Most of the times this works as intended
   
   
   ### What does actually happen?
   Sometimes the app restarts completely.
   
   
   ## Information
   The logs I've gathered using logcat and a Honeywell EDA71-1:
   
   ```
   // WHEN EVERY THING GOES AS EXPECTED
   08-30 16:57:35.774 23886 24172 W PluginManager: THREAD WARNING: exec() call to Camera.takePicture blocked the main thread for 70ms. Plugin should use CordovaInterface.getThreadPool().
   08-30 16:57:35.776 23886 23886 D CordovaActivity: Paused the activity.
   08-30 16:57:36.785 23886 23886 D CordovaActivity: Stopped the activity.
   08-30 16:57:41.627 23886 23886 D CordovaActivity: Incoming Result. Request code = 33
   08-30 16:57:41.627 23886 23886 D CordovaInterfaceImpl: Sending activity result to plugin
   08-30 16:57:42.036 23886 23886 D CordovaActivity: Started the activity.
   08-30 16:57:42.039 23886 23886 D CordovaActivity: Resumed the activity.
   08-30 16:57:42.111 23886 24003 D SERVER  : Handling local request: http://localhost/assets/icon/favicon.png
   08-30 16:57:42.111 23886 23886 D NetworkManager: toLower : wifi
   08-30 16:57:42.111 23886 23886 D NetworkManager: wifi : wifi
   08-30 16:57:42.111 23886 23886 D NetworkManager: Connection Type: wifi
   08-30 16:57:42.111 23886 23886 D NetworkManager: Connection Extra Info: null
   08-30 16:57:42.309 23886 24003 D SERVER  : Handling local request: http://localhost/assets/icon/favicon.png
   
   // WHEN THE APP RESTARTS
   08-30 16:57:44.081 23886 24172 W PluginManager: THREAD WARNING: exec() call to Camera.takePicture blocked the main thread for 26ms. Plugin should use CordovaInterface.getThreadPool().
   08-30 16:57:44.084 23886 23886 D CordovaActivity: Paused the activity.
   08-30 16:57:44.714 23886 23886 D CordovaActivity: Stopped the activity.
   08-30 16:57:47.359  1534  8868 I ActivityManager: Process <package.id> (pid 23886) has died: prev LAST
   08-30 16:57:47.359  1534  1598 I libprocessgroup: Successfully killed process cgroup uid 10176 pid 23886 in 0ms
   08-30 16:57:47.360   994   994 I Zygote  : Process 23886 exited due to signal 9 (Killed)
   08-30 16:57:47.378  1534  1589 W ActivityManager: setHasOverlayUi called on unknown pid: 23886
   ``` 
   
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   ```javascript
   // Camera options
   this.defaultCameraOptions = {
       quality: 80,
       destinationType: DestinationType.DATA_URL,
       encodingType: EncodingType.JPEG,
       mediaType: MediaType.PICTURE,
       targetHeight: 1000,
       targetWidth: 1000,
       correctOrientation: true,
       saveToPhotoAlbum: false,
       cameraDirection: 0,
       sourceType: PictureSourceType.CAMERA
   };
   
   const cameraResult: string = await this.camera.getPicture(this.defaultCameraOptions);
   
   let resultBase64: string = '';
   if (cameraResult) {
       resultBase64 = 'data:image/jpeg;base64,' + cameraResult;
   }
   
   console.log(resultBase64);
   ```
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you experiencing the issue? -->
   Ionic, android 10. Different devices. Honeywell EDA71-1, Zebra TC75
   
   
   ### Version information
   <!-- 
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins 
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   
   Ionic CLI (ionic -v): 6.12.1
   cordova (cordova -v): 9.0.0
   
   @ionic/angular: 5.2.3
   @ionic-native/camera: 5.27.0
   cordova-android: 8.1.0
   cordova-plugin-camera: 5.0.3,
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [X] I searched for existing GitHub issues
   - [X] I updated all Cordova tooling to most recent version
   - [X] I included all the necessary information above
   


-- 
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-unsubscribe@cordova.apache.org

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



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


[GitHub] [cordova-plugin-camera] breautek edited a comment on issue #758: Ionic app sometimes restarts after taking a picture

Posted by GitBox <gi...@apache.org>.
breautek edited a comment on issue #758:
URL: https://github.com/apache/cordova-plugin-camera/issues/758#issuecomment-908441374


   This is normal behaviour on Android - a quirk due to the android Intent system and is documented in the [Android Quirks](https://github.com/apache/cordova-plugin-camera#android-quirks).
   
   > 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.
   
   In Android, any app that is not in the foreground process is susceptible to being closed/killed by the OS. When using intents - the app is placed in the background while the camera app is shown. When the activity is killed, the webview is also destroyed.
   
   I know this sucks and can be difficult to deal with but it's up to the developer to restore the state of their app in this situation. The camera results will also be included in the [resume event](https://cordova.apache.org/docs/en/dev/guide/platforms/android/index.html#retrieving-plugin-callback-results-cordova-android-510) in this situation.
   
   When the OS chooses to kill a background activity isn't explicitly defined, but it's usually related to when the OS feels the need to free up RAM, and operating the camera can be heavy on RAM.
   
   Closing this issue as not-a-bug; but if you have any other questions, feel free to ask and I'll try to answer them to the best of my ability.


-- 
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-unsubscribe@cordova.apache.org

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



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


[GitHub] [cordova-plugin-camera] breautek commented on issue #758: Ionic app sometimes restarts after taking a picture

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #758:
URL: https://github.com/apache/cordova-plugin-camera/issues/758#issuecomment-908441374


   This is normal behaviour on Android - a quirk due to the android Intent system and is documented in the [Android Quirks](https://github.com/apache/cordova-plugin-camera#android-quirks).
   
   > 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.
   
   In Android, any app that is not in the foreground process is susceptible to being closed/killed by the OS. When using intents - the app is placed in the background while the camera app is shown. When the activity is killed, the webview is also destroyed.
   
   I know this sucks and can be difficult but it's up to the developer to restore the state in this situation. The camera results will also be included in the [resume event](https://cordova.apache.org/docs/en/dev/guide/platforms/android/index.html#retrieving-plugin-callback-results-cordova-android-510) in this situation.
   
   When the OS chooses to kill a background activity isn't explicitly defined, but it's usually related to when the OS feels the need to free up RAM, and operating the camera can be heavy on RAM.
   
   Closing this issue as not-a-bug; but if you have any other questions, feel free to ask and I'll try to answer them to the best of my ability.


-- 
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-unsubscribe@cordova.apache.org

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



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


[GitHub] [cordova-plugin-camera] breautek commented on issue #758: Ionic app sometimes restarts after taking a picture

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #758:
URL: https://github.com/apache/cordova-plugin-camera/issues/758#issuecomment-908441374


   This is normal behaviour on Android - a quirk due to the android Intent system and is documented in the [Android Quirks](https://github.com/apache/cordova-plugin-camera#android-quirks).
   
   > 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.
   
   In Android, any app that is not in the foreground process is susceptible to being closed/killed by the OS. When using intents - the app is placed in the background while the camera app is shown. When the activity is killed, the webview is also destroyed.
   
   I know this sucks and can be difficult but it's up to the developer to restore the state in this situation. The camera results will also be included in the [resume event](https://cordova.apache.org/docs/en/dev/guide/platforms/android/index.html#retrieving-plugin-callback-results-cordova-android-510) in this situation.
   
   When the OS chooses to kill a background activity isn't explicitly defined, but it's usually related to when the OS feels the need to free up RAM, and operating the camera can be heavy on RAM.
   
   Closing this issue as not-a-bug; but if you have any other questions, feel free to ask and I'll try to answer them to the best of my ability.


-- 
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-unsubscribe@cordova.apache.org

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



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


[GitHub] [cordova-plugin-camera] breautek closed issue #758: Ionic app sometimes restarts after taking a picture

Posted by GitBox <gi...@apache.org>.
breautek closed issue #758:
URL: https://github.com/apache/cordova-plugin-camera/issues/758


   


-- 
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-unsubscribe@cordova.apache.org

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



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


[GitHub] [cordova-plugin-camera] breautek edited a comment on issue #758: Ionic app sometimes restarts after taking a picture

Posted by GitBox <gi...@apache.org>.
breautek edited a comment on issue #758:
URL: https://github.com/apache/cordova-plugin-camera/issues/758#issuecomment-908441374


   This is normal behaviour on Android - a quirk due to the android Intent system and is documented in the [Android Quirks](https://github.com/apache/cordova-plugin-camera#android-quirks).
   
   > 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.
   
   In Android, any app that is not in the foreground process is susceptible to being closed/killed by the OS. When using intents - the app is placed in the background while the camera app is shown. When the activity is killed, the webview is also destroyed.
   
   I know this sucks and can be difficult to deal with but it's up to the developer to restore the state of their app in this situation. The camera results will also be included in the [resume event](https://cordova.apache.org/docs/en/dev/guide/platforms/android/index.html#retrieving-plugin-callback-results-cordova-android-510) in this situation.
   
   When the OS chooses to kill a background activity isn't explicitly defined, but it's usually related to when the OS feels the need to free up RAM, and operating the camera can be heavy on RAM.
   
   Closing this issue as not-a-bug; but if you have any other questions, feel free to ask and I'll try to answer them to the best of my ability.


-- 
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-unsubscribe@cordova.apache.org

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



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


[GitHub] [cordova-plugin-camera] breautek closed issue #758: Ionic app sometimes restarts after taking a picture

Posted by GitBox <gi...@apache.org>.
breautek closed issue #758:
URL: https://github.com/apache/cordova-plugin-camera/issues/758


   


-- 
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-unsubscribe@cordova.apache.org

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



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