Open passiondroid opened 7 years ago
@passiondroid Can you please tell me the steps to reproduce the bug?
@kevalpatel2106 It started coming today only. Earlier it was not crashing. I am using HiddenCameraService and when takePicture() is called within the service from onStartCommand(). It throws exception with logs
android.hardware.Camera.native_takePicture(Native Method)
@passiondroid On which device you were testing?
@kevalpatel2106 Moto G4 plus
Great! Let me check the problem. Meanwhile if you find the issue, you can always generate PR.
Ok, I will clone the repo from here as soon as i get some time. I dont know why it stopped working. It was working fine earlier.
Are you using v1.3? or 1.2.1?
I am using 1.2.1
Can you test if this issue still occurs in v1.3? I made some changes in v1.3. (See commit: https://github.com/kevalpatel2106/android-hidden-camera/commit/73ce010210641ae5421c924983f2997fecea0723)
I am still getting the same exception after changing to 1.3
@passiondroid I made some changes in latest version. Now, HiddenCameraService
won't allow you to capture multiple photos simultaneously (like burst mode) because the camera is already acquired while capturing the second image.
Basically, HiddenCameraService
won't allow you to take the second picture until the first picture is captured and processed.
Fix in release v1.3.2.
Maybe the issue is still open
Exception java.lang.RuntimeException: takePicture failed
android.hardware.Camera.native_takePicture (Camera.java) android.hardware.Camera.takePicture (Camera.java:1473) android.hardware.Camera.takePicture (Camera.java:1418) com.androidhiddencamera.CameraPreview.takePictureInternal (CameraPreview.java:196) com.androidhiddencamera.HiddenCameraService.takePicture (HiddenCameraService.java:95) com.app.mytest.MyCamService$1.run (MyCamService.java:77) android.os.Handler.handleCallback (Handler.java:751) android.os.Handler.dispatchMessage (Handler.java:95) android.os.Looper.loop (Looper.java:154) android.app.ActivityThread.main (ActivityThread.java:6776) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1518) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)
On devices: Samsung SM-A320Y (API 24) Android 7.0 Samsung SM-A510F (API 24) Android 7.0 Samsung SM-G570F (API 24) Android 7.0 Samsung SM-G930A (API 24) Android 7.0 Samsung SM-G930F (API 24) Android 7.0 Samsung SM-G950F (API 24) Android 7.0 Samsung SM-J530FM (API 24) Android 7.0 Samsung SM-J710F (API 24) Android 7.0 Samsung SM-J701F (API 24) Android 7.0 Samsung SM-J700H (API 23) Android 6.0.1 Samsung SM-N920C (API 24) Android 7.0 Xiaomi Redmi Note 4 (API 24) Android 7.0 Motorola Moto G Play (API 23) Android 6.0.1
The application works on these devices, but sometimes this bug appears randomly. The most popular are samsung devices with android 7.0
I found this and this on Stackoverflow. Recommendations are as follows:
Add:
SurfaceTexture st = new SurfaceTexture(MODE_PRIVATE);
pCamera.setPreviewTexture(st);
before:pCamera.startPreview();
The problem has been in version 1.3.5...This version an be used to take images in burst mode..use that version instead.
@sid96 can you please show how to take images in burst mode?
Add: SurfaceTexture st = new SurfaceTexture(MODE_PRIVATE); pCamera.setPreviewTexture(st); before: pCamera.startPreview();
works for me on honeywell ED70 , android 7