Android API
Previous Home Next

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

  1. 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.
  2. <uses-permission android:name="android.permission.CAMERA" />
     <uses-feature android:name="" />
     <uses-feature android:name="" />
  3. android.hardware.Camera.CameraInfo: This class have Information about a camera.
  4. android.hardware.Sensor class : Sensor Class representing a sensor. WE can get get the list of available Sensors by getSensorList(int).
  5. android.hardware.SensorManager : This class is used to access the device's sensors.

Commanly Used interface in android.hardware package :

  1. android.hardware.Camera.AutoFocusCallback: This interface is used to notify on completion of camera auto focus.
  2. android.hardware.Camera.ErrorCallback: This interface return error notification.
  3. android.hardware.Camera.OnZoomChangeListener: This is used for zoom changes during a smooth zoom operation.
  4. android.hardware.Camera.ShutterCallback: This interface used to signal the moment of actual image capture.
  5. android.hardware.SensorEventListener: This is used for receiving notifications when sensor values have changed.
  6. android.hardware.SensorListener: This interface is deprecated. Use SensorEventListener instead.
  7. 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 :

  1. UsbManager: Used to access the state of the USB.
  2. UsbDevice : Used for communicate with the hardware peripheral if the Android-powered device is acting as the USB host.
  3. UsbAccessory: This class representing a USB accessory, which is an external hardware component that communicates with an android application over USB.
Previous Home Next