DATA_URL: Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible.
It looks like if you use DATA URL your device might not be able to handle it and it crashes for that reason.
You should use platform to detect if its android or iOS, then use FILE_URI for android and NATIVE_URI for iOS.
Are you by chance creating the function before you declare camera? I.e., above the constructor? Is the camera set to private as opposed to public?
Just a couple of maybes
Thanks for the reply. So I changed private to public and DATA_URI to FILE_URI, and that seemed to clear things up a bit. The app doesn’t crash anymore. So it is using lesser memory.
However, I need to upload the image I take to an external service using a POST request, and therefore DATA_URI (base64 string of the image) is the only way forward. Is there any chance I could continue using DATA_URI and still not use more than the memory allotted to the app?