Used Hardware API
android.hardware : With the help of android.hardware package, we gets support for hardware features, such as the camera and other sensors. but your application requires using the <uses-feature > manifest element because all Android-powered devices not support all hardware features.
Commanly Used class in android.hardware package
- android.hardware.Camera: This class is used to set image capture settings, start/stop preview, snap pictures, and retrieve frames for encoding for video. if we want to access the device camera, you must declare the CAMERA permission in your Android Manifest file.
- android.hardware.Camera.CameraInfo: This class have Information about a camera.
- android.hardware.Sensor class : Sensor Class representing a sensor. WE can get get the list of available Sensors by getSensorList(int).
- android.hardware.SensorManager : This class is used to access the device's sensors.
<uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" />
Commanly Used interface in android.hardware package :
- android.hardware.Camera.AutoFocusCallback: This interface is used to notify on completion of camera auto focus.
- android.hardware.Camera.ErrorCallback: This interface return error notification.
- android.hardware.Camera.OnZoomChangeListener: This is used for zoom changes during a smooth zoom operation.
- android.hardware.Camera.ShutterCallback: This interface used to signal the moment of actual image capture.
- android.hardware.SensorEventListener: This is used for receiving notifications when sensor values have changed.
- android.hardware.SensorListener: This interface is deprecated. Use SensorEventListener instead.
- android.hardware.usb : With the help of this package, we provides support to communicate with USB hardware peripherals that are connected to Android-powered devices.
Commanly Used class in android.hardware package :
- UsbManager: Used to access the state of the USB.
- UsbDevice : Used for communicate with the hardware peripheral if the Android-powered device is acting as the USB host.
- UsbAccessory: This class representing a USB accessory, which is an external hardware component that communicates with an android application over USB.