What is Android silent shooting and how to make Android silent shooting app

Introduction: when making the user's head, it suddenly occurred to me that a while ago (probably a long time ago), Alipay had secretly photographed the user's life photos, the real head, and was badly sprayed. However, as an Android Developer, my first reaction was to hold the grass. How did he achieve it. In my impression, IOS has very strict control over permissions, and it should be very difficult to secretly tune up the camera. However, before Android 4.2, it can be said that developers almost had system permissions, and their ability was terrible. Now Android has reached 7.0, although most users are still in 4.4 to 6.0. I think I'll also make a silent shooting app.

Text:

The so-called silent shooting is shooting without the user's perception.

Generally, there will be preview area and sound of taking pictures. Removing these things is the real silent shooting. First, I made a very normal self timer software, just a button. After shooting, save it to a location in the folder. Then I tried it. It was OK and there was no difficulty at all. Then the surfaceview is cleared. I first thought of setvisibility as gone, and then reported an error. Very embarrassed. The next solution is to use the method that the height and width are 0, but there is no egg, which is more embarrassing.

Then think about whether there is any good way. Then cover the surfaceview. It's perfect. Cover it casually, and then take the photos as usual. Reasonable.

But the "click" sound of taking pictures is really embarrassing, and then I thought of mute. I set mute when the page opens. It seems that this is a very stable method, and then something more embarrassing happened. When the mute is set, the mobile phone vibrates, even if it vibrates. The key is that the sound of taking pictures has not been removed. Then I checked the volume of the camera. Then something sad happened:

Google's Android developers wrote the shutter sound playback function in the photographing method, or in the framework layer, in order to improve the user experience of Android users and prevent developers from developing apps for silent photographing, thereby violating privacy. I was very sad in an instant. As an ordinary third-party developer, I don't have so many permissions to change the method of the framework layer.

Then I decided to save the country. Because we didn't take pictures during preview, but actually we have got the picture stream brought by the camera. This is critical. Then I turned the picture into a bitmap, saved it locally, and then turned off the camera. God unknowingly took the selfie. Of course, there are some small problems, such as image coding, image rotation, local storage and obtaining frame images. But these can be solved. The train of thought is still the train of thought I mentioned above, and various forms of expression can be made by ourselves.

Basically, this code can realize simple silent photography.

Remaining problems:

The picture quality is a little low.

At present, there is no way, because I can only get the frame image of surfaceview, and the quality of the frame image displayed in the preview is very touching. So I have to say there's no way.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>