The previous recipe demonstrated how to use an Intent to call the default photo application. If you only need a quick photo, the Intent is probably the ideal solution. If not, and you need more control over the camera, this recipe will show you how to use the camera directly with the Camera2 API.
Now that 85% of devices are using Android 5.0 or later, this recipe focuses only on the Camera2 API. (Google has already deprecated the original Camera API.)