Android Guides | Samples

Android.Hardware Namespace

Provides support for hardware features, such as the camera and other sensors.

Remarks

Provides support for hardware features, such as the camera and other sensors. Be aware that not all Android-powered devices support all hardware features, so you should declare hardware that your application requires using the <uses-feature> manifest element.

Classes

TypeReason
AccuracyChangedEventArgs
AxisEnumerates values returned by several methods of Axis and taken as a parameter of the SensorManager.RemapCoordinateSystem, and SensorManager.RemapCoordinateSystem members.
CameraThe Camera class is used to set image capture settings, start/stop preview, snap pictures, and retrieve frames for encoding for video.
Camera+Area
Camera+CameraInfoInformation about a camera
Camera+FaceInformation about a face identified through camera face detection.
Camera+FaceDetectionEventArgsProvides data for the Camera.FaceDetection event.
Camera+IAutoFocusCallbackCallback interface used to notify on completion of camera auto focus.
Camera+IAutoFocusMoveCallbackCallback interface used to notify on auto focus start and stop.
Camera+IErrorCallbackCallback interface for camera error notification.
Camera+IFaceDetectionListenerCallback interface for face detected in the preview frame.
Camera+IOnZoomChangeListenerCallback interface for zoom changes during a smooth zoom operation.
Camera+IPictureCallbackCallback interface used to supply image data from a photo capture.
Camera+IPreviewCallbackCallback interface used to deliver copies of preview frames as they are displayed.
Camera+IShutterCallbackCallback interface used to signal the moment of actual image capture.
Camera+ParametersCamera service settings.
Camera+SizeImage size (width and height dimensions).
Camera+ZoomChangeEventArgsProvides data for the Camera.ZoomChange event.
CameraErrorEnumerates values returned by the CameraError.ServerDied, and CameraError.Unknown members and taken as a parameter of the Camera+IErrorCallback.OnError member.
CameraFacingEnumerates values returned by several types.
ConsumerIrManagerClass that operates consumer infrared on the device.
ConsumerIrManager+CarrierFrequencyRange
FocusDistanceEnumerates values returned by several types.
GeomagneticFieldEstimates magnetic field at a given point on Earth, and in particular, to compute the magnetic declination from true north.
ISensorEventListenerUsed for receiving notifications from the SensorManager when sensor values have changed.
ISensorEventListener2Used for receiving a notification when a flush() has been successfully completed.
ISensorListenerUsed for receiving notifications from the SensorManager when sensor values have changed.
PreviewEnumerates values returned by several types.
ReportingModeEnumerates values returned by several types.
SensorClass representing a sensor.
SensorChangedEventArgs
SensorDelayEnumerates values returned by several methods of SensorDelay and taken as a parameter of several types.
SensorEventThis class represents a Sensor event and holds informations such as the sensor's type, the time-stamp, accuracy and of course the sensor's SensorEvent.Values.
SensorListenerAccuracyChangedEventArgs
SensorListenerSensorChangedEventArgs
SensorManager

java Example

 public class SensorActivity extends Activity, implements SensorEventListener {
     private final SensorManager mSensorManager;
     private final Sensor mAccelerometer;

     public SensorActivity() {
         mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
         mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
     }

     protected void onResume() {
         super.onResume();
         mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
     }

     protected void onPause() {
         super.onPause();
         mSensorManager.unregisterListener(this);
     }

     public void onAccuracyChanged(Sensor sensor, int accuracy) {
     }

     public void onSensorChanged(SensorEvent event) {
     }
 }
SensorStatusEnumerates values returned by several types and taken as a parameter of several types.
SensorTypeEnumerates values returned by several types and taken as a parameter of several types.
TriggerEventThis class represents a Trigger Event - the event associated with a Trigger Sensor.
TriggerEventListenerThis class is the listener used to handle Trigger Sensors.