我们可以在没有相机预览的情况下使用 android 中的 takePicture() 吗?为了安全起见,我需要偷偷拍照

Can we use takePicture() in android without camera preview? I need to take a picture secretly for security purposes

我尝试了这里的一些代码:

How to capture an image in background without using the camera application

还有这个

Android Camera API Tutorial.

这个问题可能看起来重复了,但我真的很想知道这可以在 API 21 级完成吗?

提前致谢。

根据android.developer.com,没有。

https://developer.android.com/reference/android/hardware/Camera.html

"Important: Call startPreview() to start updating the preview surface. Preview must be started before you can take a picture."