Permissions and Features

Prior to getting into the details of adding camera integration, we will discuss more about the general permissions and features related to the camera. The following table contains the various permissions that may be required. In our case, we need not specify any of these, because we are using an external camera app to capture the picture.

Permission

Description

CAMERA

If your app requests permission to use the device's camera, this is not required if you make the request through an intent

WRITE_EXTERNAL_STORAGE

If your app saves images or videos to the devices external storage (SD card)

RECORD_AUDIO

If your app records audio with video capture

ACCESS_FINE_LOCATION

If your app tags photos with GPS location information

Camera-specific features can be set up in an app's manifest file using the <uses-feature/> element. The following features are defined:

Feature

Description

android.hardware.camera

The application uses the device's camera. If the device supports multiple cameras, the application uses the camera that faces away from the screen.

android.hardware.camera.autofocus

Subfeature. The application uses the device camera's autofocus capability.

android.hardware.camera.flash

Subfeature. The application uses the device camera's flash.

android.hardware.camera.front

Subfeature. The application uses a front-facing camera on the device.

android.hardware.camera.any

The application uses at least one camera facing any direction. Use this in preference to android.hardware.camera if a back-facing camera is not required.

In our case, we will not specify any features as requirements, but at runtime, we will check to be sure an external app is available to capture a photo. This would allow anyone to install and use our app even if their device did not have a camera.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.47.253