You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/10/12 16:58:20 UTC

[GitHub] [cordova-plugin-camera] breautek commented on issue #345: Camera plugin crashes app on some android phones when an image is taken

breautek commented on issue #345: Camera plugin crashes app on some android phones when an image is taken
URL: https://github.com/apache/cordova-plugin-camera/issues/345#issuecomment-541342728
 
 
   On modern devices, this can be a problem when using the `DATA_URL` destination. This is because it needs to encode an already large image binary into a base64 encoded string, which expands the data by about 40%. This can be a problem for devices that have low memory limits.
   
   This is noted in the documentation:
   
   >NOTE: Photo resolution on newer devices is quite good. Photos selected from the device's gallery are not downscaled to a lower quality, even if a quality parameter is specified. To avoid common memory problems, set Camera.destinationType to FILE_URI rather than DATA_URL.
   
   Using a `FILE_URI` will give you a url that can be read into a blob, which is far more efficient for representing binary data. You can also use blobs to create an object url to use in html tags like `<img>` tags, or send to a remote server using `XMLHttpRequest`.
   
   > I am facing same issue. I am using FILE_URI as destinationType. My phone contains lot of free memory, still app crashes when i try to take pictures.
   
   Many phones imposes a memory quota, so having lots of free money doesn't mean all that memory is available for any individual app. You could also be experiencing another android quirk, also documented below:
   
   >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.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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