The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.
Most Android devices will have a camera, since they are fairly commonplace on mobile devices these days. You, as an Android developer, can take advantage of the camera, for everything from snapping tourist photos to scanning barcodes. If you wish to let other apps do the “heavy lifting” for you, working with the camera can be fairly straightforward. If you want more control, you can work with the camera directly, though this control comes with greater complexity.
You can also record videos using the camera. Once again, you have the option of either using a third-party activity, or doing it yourself.
Understanding this chapter requires that you have read the core chapters,
particularly the material on implicit
Intents. You also need
to read the chapters on the
ContentProvider component, particularly
the coverage of
If your app needs a camera — by any of the means cited in this chapter –
you should include a
<uses-feature> element in the manifest indicating your requirements. However, you
need to be fairly specific about your requirements here.
For example, the Nexus 7 (2012) has a camera… but only a front-facing camera. This facilitates
apps like video chat. However, the
android.hardware.camera implies that you need
a high-resolution rear-facing camera.
Hence, to work with the Nexus 7’s camera, you need to:
CAMERApermission (if you are using the
android.hardware.camera.frontfeature (if your app definitely needs a front-facing camera)
At runtime, you would use
PackageManager, or interrogate
Camera class for available cameras, to determine what you have access to.
Note that if you want to record audio when recording videos, you should also consider
The preview of this section was eaten by a grue.
The preview of this section is unavailable right now, but if you leave your name and number at the sound of the tone, it might get back to you (BEEEEEEEEEEEEP!).
The preview of this section was last seen in the Bermuda Triangle.
The preview of this section is sleeping in.
The preview of this section is presently indisposed.
The preview of this section apparently resembled a Pokémon.
The preview of this section is in the process of being translated from its native Klingon.