NativeScript / nativescript-camera

NativeScript plugin to empower using device camera.
Apache License 2.0
92 stars 47 forks source link

Native camera crashing on Sony Xperia devices #233

Open Willhay108-imprint opened 4 years ago

Willhay108-imprint commented 4 years ago

Which platform(s) does your issue occur on?

Android, specifically Sony Xperia devices.

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

When taking a photo on my app on a Sony Xperia phone, the camera app reliably crashes upon pressing the circular camera button inside the native camera app. The take picture noise correctly sounds, but no picture is taken, the take photo button is disabled but the camera is still active it never goes to the confirm picture page. After a few seconds a notification pops up to say the camera app has stopped working.

This same code block is used and works correctly on all ios devices I have tried, and all other android devices (a range of phones and tablets), the problem exists reliably only on Sony Xperia phones.

Is there any code involved?

cameraModule.requestPermissions().then(() => { debugger; cameraModule.takePicture().then((imageAsset) => { debugger; imageSourceModule.fromAsset(imageAsset).then(imageSource => { debugger; const savePath = fsModule.knownFolders.documents().path; const fileName = "img_" + new Date(Date.now()).getTime() + "." + format; const filePath = fsModule.path.join(savePath, fileName); if (imageSource.saveToFile(filePath, format, 50)) { this.new_answer = filePath; } }).catch((e)=>{ debugger; console.log(e); });

In this code block, the first debugger will hit correctly before the camera app has opened. After pressing the take photo button though, no other debuggers hit and the camera crashes.

PashaArkus commented 4 years ago

this problem exists on other devices, even on some iphone