Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/view/InputDevice#nestedclasses) \| [Constants](https://developer.android.com/reference/android/view/InputDevice#constants) \| [Inherited Constants](https://developer.android.com/reference/android/view/InputDevice#inhconstants) \| [Fields](https://developer.android.com/reference/android/view/InputDevice#lfields) \| [Methods](https://developer.android.com/reference/android/view/InputDevice#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/view/InputDevice#inhmethods)

# InputDevice

*** ** * ** ***

` public final class InputDevice `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/os/Parcelable `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.view.InputDevice |

<br />

*** ** * ** ***

Describes the capabilities of a particular input device.

Each input device may support multiple classes of input. For example, a multi-function keyboard may compose the capabilities of a standard keyboard together with a track pad mouse or other pointing device.

Some input devices present multiple distinguishable sources of input. Applications can query the framework about the characteristics of each distinct source.

As a further wrinkle, different kinds of input sources uses different coordinate systems to describe motion events. Refer to the comments on the input source constants for the appropriate interpretation.

<br />

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/view/InputDevice.MotionRange` Provides information about the range of values for a particular `https://developer.android.com/reference/android/view/MotionEvent` axis. |
| ` class` | `https://developer.android.com/reference/android/view/InputDevice.ViewBehavior` Provides information on how views processing `https://developer.android.com/reference/android/view/MotionEvent`s generated by this input device should respond to the events. |

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/view/InputDevice#KEYBOARD_TYPE_ALPHABETIC` The keyboard supports a complement of alphabetic keys. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#KEYBOARD_TYPE_NONE` There is no keyboard. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#KEYBOARD_TYPE_NON_ALPHABETIC` The keyboard is not fully alphabetic. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#MOTION_RANGE_ORIENTATION` *This constant was deprecated in API level 15. Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_ORIENTATION` instead.* |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#MOTION_RANGE_PRESSURE` *This constant was deprecated in API level 15. Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_PRESSURE` instead.* |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#MOTION_RANGE_SIZE` *This constant was deprecated in API level 15. Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_SIZE` instead.* |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#MOTION_RANGE_TOOL_MAJOR` *This constant was deprecated in API level 15. Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_TOOL_MAJOR` instead.* |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#MOTION_RANGE_TOOL_MINOR` *This constant was deprecated in API level 15. Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_TOOL_MINOR` instead.* |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#MOTION_RANGE_TOUCH_MAJOR` *This constant was deprecated in API level 15. Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_TOUCH_MAJOR` instead.* |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#MOTION_RANGE_TOUCH_MINOR` *This constant was deprecated in API level 15. Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_TOUCH_MINOR` instead.* |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#MOTION_RANGE_X` *This constant was deprecated in API level 15. Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_X` instead.* |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#MOTION_RANGE_Y` *This constant was deprecated in API level 15. Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_Y` instead.* |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_ANY` A special input source constant that is used when filtering input devices to match devices that provide any type of input source. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_BLUETOOTH_STYLUS` The input device is a Bluetooth stylus. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_BUTTON` The input source has buttons or keys. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_JOYSTICK` The input source is a joystick. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_MASK` A mask for input source classes. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_NONE` The input source has no class. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_POINTER` The input source is a pointing device associated with a display. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_POSITION` The input source is an absolute positioning device not associated with a display (unlike `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_POINTER`). |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_TRACKBALL` The input source is a trackball navigation device. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_DPAD` The input source is a DPad. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_GAMEPAD` The input source is a game pad. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_HDMI` The input source is a device connected through HDMI-based bus. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_JOYSTICK` The input source is a joystick. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_KEYBOARD` The input source is a keyboard. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_MOUSE` The input source is a mouse pointing device. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_MOUSE_RELATIVE` The input source is a mouse device whose relative motions should be interpreted as navigation events. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_ROTARY_ENCODER` The input source is a rotating encoder device whose motions should be interpreted as akin to those of a scroll wheel. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_SENSOR` The input source is a sensor associated with the input device. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_STYLUS` The input source is a stylus pointing device. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_TOUCHPAD` The input source is a touchpad (also known as a trackpad). |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_TOUCHSCREEN` The input source is a touch screen pointing device. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_TOUCH_NAVIGATION` The input source is a touch device whose motions should be interpreted as navigation events. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_TRACKBALL` The input source is a trackball. |
| `int` | `https://developer.android.com/reference/android/view/InputDevice#SOURCE_UNKNOWN` The input source is unknown. |

### Inherited constants

From interface `https://developer.android.com/reference/android/os/Parcelable` `int` `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR`

Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor.
`int` `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`

Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`".

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/view/InputDevice>` | `https://developer.android.com/reference/android/view/InputDevice#CREATOR` <br /> |

| ### Public methods ||
|---|---|
| ` int` | ` https://developer.android.com/reference/android/view/InputDevice#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` int` | ` https://developer.android.com/reference/android/view/InputDevice#getAssociatedDisplayId()() ` Returns the associated display id of this input device. |
| ` https://developer.android.com/reference/android/hardware/BatteryState` | ` https://developer.android.com/reference/android/view/InputDevice#getBatteryState()() ` Gets the battery state object associated with the device, if there is one. |
| ` int` | ` https://developer.android.com/reference/android/view/InputDevice#getControllerNumber()() ` The controller number for a given input device. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/view/InputDevice#getDescriptor()() ` Gets the input device descriptor, which is a stable identifier for an input device. |
| ` static https://developer.android.com/reference/android/view/InputDevice` | ` https://developer.android.com/reference/android/view/InputDevice#getDevice(int)(int id) ` Gets information about the input device with the specified id. |
| ` static int[]` | ` https://developer.android.com/reference/android/view/InputDevice#getDeviceIds()() ` Gets the ids of all input devices in the system. |
| ` int` | ` https://developer.android.com/reference/android/view/InputDevice#getId()() ` Gets the input device id. |
| ` https://developer.android.com/reference/android/view/KeyCharacterMap` | ` https://developer.android.com/reference/android/view/InputDevice#getKeyCharacterMap()() ` Gets the key character map associated with this input device. |
| ` int` | ` https://developer.android.com/reference/android/view/InputDevice#getKeyCodeForKeyLocation(int)(int locationKeyCode) ` Gets the `https://developer.android.com/reference/android/view/KeyEvent` produced by the given location on a reference QWERTY keyboard layout. |
| ` int` | ` https://developer.android.com/reference/android/view/InputDevice#getKeyboardType()() ` Gets the keyboard type. |
| ` https://developer.android.com/reference/android/hardware/lights/LightsManager` | ` https://developer.android.com/reference/android/view/InputDevice#getLightsManager()() ` Gets the lights manager associated with the device, if there is one. |
| ` https://developer.android.com/reference/android/view/InputDevice.MotionRange` | ` https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int)(int axis) ` Gets information about the range of values for a particular `https://developer.android.com/reference/android/view/MotionEvent` axis. |
| ` https://developer.android.com/reference/android/view/InputDevice.MotionRange` | ` https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int,%20int)(int axis, int source) ` Gets information about the range of values for a particular `https://developer.android.com/reference/android/view/MotionEvent` axis used by a particular source on the device. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/view/InputDevice.MotionRange>` | ` https://developer.android.com/reference/android/view/InputDevice#getMotionRanges()() ` Gets the ranges for all axes supported by the device. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/view/InputDevice#getName()() ` Gets the name of this input device. |
| ` int` | ` https://developer.android.com/reference/android/view/InputDevice#getProductId()() ` Gets the product id for the given device, if available. |
| ` https://developer.android.com/reference/android/hardware/SensorManager` | ` https://developer.android.com/reference/android/view/InputDevice#getSensorManager()() ` Gets the sensor manager service associated with the input device. |
| ` int` | ` https://developer.android.com/reference/android/view/InputDevice#getSources()() ` Gets the input sources supported by this input device as a combined bitfield. |
| ` int` | ` https://developer.android.com/reference/android/view/InputDevice#getVendorId()() ` Gets the vendor id for the given device, if available. |
| ` https://developer.android.com/reference/android/os/Vibrator` | ` https://developer.android.com/reference/android/view/InputDevice#getVibrator()() ` *This method was deprecated in API level 31. Use `https://developer.android.com/reference/android/view/InputDevice#getVibratorManager()` to retrieve the default device vibrator.* |
| ` https://developer.android.com/reference/android/os/VibratorManager` | ` https://developer.android.com/reference/android/view/InputDevice#getVibratorManager()() ` Gets the vibrator manager associated with the device. |
| ` boolean[]` | ` https://developer.android.com/reference/android/view/InputDevice#hasKeys(int[])(int... keys) ` Gets whether the device is capable of producing the list of keycodes. |
| ` boolean` | ` https://developer.android.com/reference/android/view/InputDevice#hasMicrophone()() ` Reports whether the device has a built-in microphone. |
| ` boolean` | ` https://developer.android.com/reference/android/view/InputDevice#isEnabled()() ` Returns true if input device is enabled. |
| ` boolean` | ` https://developer.android.com/reference/android/view/InputDevice#isExternal()() ` Returns true if the device is external (connected to USB or Bluetooth or some other peripheral bus), otherwise it is built-in. |
| ` boolean` | ` https://developer.android.com/reference/android/view/InputDevice#isVirtual()() ` Returns true if the device is a virtual input device rather than a real one, such as the virtual keyboard (see `https://developer.android.com/reference/android/view/KeyCharacterMap#VIRTUAL_KEYBOARD`). |
| ` boolean` | ` https://developer.android.com/reference/android/view/InputDevice#supportsSource(int)(int source) ` Determines whether the input device supports the given source or sources. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/view/InputDevice#toString()() ` Returns a string representation of the object. |
| ` void` | ` https://developer.android.com/reference/android/view/InputDevice#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel out, int flags) ` Flatten this object in to a Parcel. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/android/os/Parcelable ` ` abstract int` ` https://developer.android.com/reference/android/os/Parcelable#describeContents()() `

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
` abstract void` ` https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) `

Flatten this object in to a Parcel.

## Constants

### KEYBOARD_TYPE_ALPHABETIC

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int KEYBOARD_TYPE_ALPHABETIC
```

The keyboard supports a complement of alphabetic keys.

<br />

Constant Value: 2 (0x00000002)

### KEYBOARD_TYPE_NONE

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int KEYBOARD_TYPE_NONE
```

There is no keyboard.

<br />

Constant Value: 0 (0x00000000)

### KEYBOARD_TYPE_NON_ALPHABETIC

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int KEYBOARD_TYPE_NON_ALPHABETIC
```

The keyboard is not fully alphabetic. It may be a numeric keypad or an assortment of buttons that are not mapped as alphabetic keys suitable for text input.

<br />

Constant Value: 1 (0x00000001)

### MOTION_RANGE_ORIENTATION

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MOTION_RANGE_ORIENTATION
```

<br />

**This constant was deprecated in API level 15.**   

Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_ORIENTATION` instead.

Constant for retrieving the range of values for `https://developer.android.com/reference/android/view/MotionEvent#AXIS_ORIENTATION`.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int)`

Constant Value: 8 (0x00000008)

### MOTION_RANGE_PRESSURE

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MOTION_RANGE_PRESSURE
```

<br />

**This constant was deprecated in API level 15.**   

Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_PRESSURE` instead.

Constant for retrieving the range of values for `https://developer.android.com/reference/android/view/MotionEvent#AXIS_PRESSURE`.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int)`

Constant Value: 2 (0x00000002)

### MOTION_RANGE_SIZE

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MOTION_RANGE_SIZE
```

<br />

**This constant was deprecated in API level 15.**   

Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_SIZE` instead.

Constant for retrieving the range of values for `https://developer.android.com/reference/android/view/MotionEvent#AXIS_SIZE`.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int)`

Constant Value: 3 (0x00000003)

### MOTION_RANGE_TOOL_MAJOR

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MOTION_RANGE_TOOL_MAJOR
```

<br />

**This constant was deprecated in API level 15.**   

Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_TOOL_MAJOR` instead.

Constant for retrieving the range of values for `https://developer.android.com/reference/android/view/MotionEvent#AXIS_TOOL_MAJOR`.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int)`

Constant Value: 6 (0x00000006)

### MOTION_RANGE_TOOL_MINOR

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MOTION_RANGE_TOOL_MINOR
```

<br />

**This constant was deprecated in API level 15.**   

Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_TOOL_MINOR` instead.

Constant for retrieving the range of values for `https://developer.android.com/reference/android/view/MotionEvent#AXIS_TOOL_MINOR`.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int)`

Constant Value: 7 (0x00000007)

### MOTION_RANGE_TOUCH_MAJOR

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MOTION_RANGE_TOUCH_MAJOR
```

<br />

**This constant was deprecated in API level 15.**   

Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_TOUCH_MAJOR` instead.

Constant for retrieving the range of values for `https://developer.android.com/reference/android/view/MotionEvent#AXIS_TOUCH_MAJOR`.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int)`

Constant Value: 4 (0x00000004)

### MOTION_RANGE_TOUCH_MINOR

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MOTION_RANGE_TOUCH_MINOR
```

<br />

**This constant was deprecated in API level 15.**   

Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_TOUCH_MINOR` instead.

Constant for retrieving the range of values for `https://developer.android.com/reference/android/view/MotionEvent#AXIS_TOUCH_MINOR`.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int)`

Constant Value: 5 (0x00000005)

### MOTION_RANGE_X

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MOTION_RANGE_X
```

<br />

**This constant was deprecated in API level 15.**   

Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_X` instead.

Constant for retrieving the range of values for `https://developer.android.com/reference/android/view/MotionEvent#AXIS_X`.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int)`

Constant Value: 0 (0x00000000)

### MOTION_RANGE_Y

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MOTION_RANGE_Y
```

<br />

**This constant was deprecated in API level 15.**   

Use `https://developer.android.com/reference/android/view/MotionEvent#AXIS_Y` instead.

Constant for retrieving the range of values for `https://developer.android.com/reference/android/view/MotionEvent#AXIS_Y`.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int)`

Constant Value: 1 (0x00000001)

### SOURCE_ANY

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_ANY
```

A special input source constant that is used when filtering input devices to match devices that provide any type of input source.

<br />

Constant Value: -256 (0xffffff00)

### SOURCE_BLUETOOTH_STYLUS

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_BLUETOOTH_STYLUS
```

The input device is a Bluetooth stylus.

Note that this bit merely indicates that an input device is capable of obtaining input from a Bluetooth stylus. To determine whether a given touch event was produced by a stylus, examine the tool type returned by `https://developer.android.com/reference/android/view/MotionEvent#getToolType(int)` for each individual pointer.

A single touch event may multiple pointers with different tool types, such as an event that has one pointer with tool type `https://developer.android.com/reference/android/view/MotionEvent#TOOL_TYPE_FINGER` and another pointer with tool type `https://developer.android.com/reference/android/view/MotionEvent#TOOL_TYPE_STYLUS`. So it is important to examine the tool type of each pointer, regardless of the source reported by `https://developer.android.com/reference/android/view/MotionEvent#getSource()`.

A bluetooth stylus generally receives its pressure and button state information from the stylus itself, and derives the rest from another source. For example, a Bluetooth stylus used in conjunction with a touchscreen would derive its contact position and pointer size from the touchscreen and may not be any more accurate than other tools such as fingers.

<br />

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#SOURCE_STYLUS`
- `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_POINTER`

Constant Value: 49154 (0x0000c002)

### SOURCE_CLASS_BUTTON

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_CLASS_BUTTON
```

The input source has buttons or keys. Examples: `https://developer.android.com/reference/android/view/InputDevice#SOURCE_KEYBOARD`, `https://developer.android.com/reference/android/view/InputDevice#SOURCE_DPAD`. A `https://developer.android.com/reference/android/view/KeyEvent` should be interpreted as a button or key press. Use `https://developer.android.com/reference/android/view/InputDevice#getKeyCharacterMap()` to query the device's button and key mappings.

<br />

Constant Value: 1 (0x00000001)

### SOURCE_CLASS_JOYSTICK

Added in [API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_CLASS_JOYSTICK
```

The input source is a joystick. A `https://developer.android.com/reference/android/view/MotionEvent` should be interpreted as absolute joystick movements. Use `https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int)` to query the range of positions.

<br />

Constant Value: 16 (0x00000010)

### SOURCE_CLASS_MASK

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_CLASS_MASK
```

A mask for input source classes. Each distinct input source constant has one or more input source class bits set to specify the desired interpretation for its input events.

<br />

Constant Value: 255 (0x000000ff)

### SOURCE_CLASS_NONE

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_CLASS_NONE
```

The input source has no class. It is up to the application to determine how to handle the device based on the device type.

<br />

Constant Value: 0 (0x00000000)

### SOURCE_CLASS_POINTER

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_CLASS_POINTER
```

The input source is a pointing device associated with a display. Examples: `https://developer.android.com/reference/android/view/InputDevice#SOURCE_TOUCHSCREEN`, `https://developer.android.com/reference/android/view/InputDevice#SOURCE_MOUSE`. A `https://developer.android.com/reference/android/view/MotionEvent` should be interpreted as absolute coordinates in display units according to the `https://developer.android.com/reference/android/view/View` hierarchy. Pointer down/up indicated when the finger touches the display or when the selection button is pressed/released. Use `https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int)` to query the range of the pointing device. Some devices permit touches outside the display area so the effective range may be somewhat smaller or larger than the actual display size.

<br />

Constant Value: 2 (0x00000002)

### SOURCE_CLASS_POSITION

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_CLASS_POSITION
```

The input source is an absolute positioning device not associated with a display (unlike `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_POINTER`). A `https://developer.android.com/reference/android/view/MotionEvent` should be interpreted as absolute coordinates in device-specific surface units. Use `https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int)` to query the range of positions.

<br />

Constant Value: 8 (0x00000008)

### SOURCE_CLASS_TRACKBALL

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_CLASS_TRACKBALL
```

The input source is a trackball navigation device. Examples: `https://developer.android.com/reference/android/view/InputDevice#SOURCE_TRACKBALL`. A `https://developer.android.com/reference/android/view/MotionEvent` should be interpreted as relative movements in device-specific units used for navigation purposes. Pointer down/up indicates when the selection button is pressed/released. Use `https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int)` to query the range of motion.

<br />

Constant Value: 4 (0x00000004)

### SOURCE_DPAD

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_DPAD
```

The input source is a DPad.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_BUTTON`

Constant Value: 513 (0x00000201)

### SOURCE_GAMEPAD

Added in [API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_GAMEPAD
```

The input source is a game pad. (It may also be a `https://developer.android.com/reference/android/view/InputDevice#SOURCE_JOYSTICK`).

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_BUTTON`

Constant Value: 1025 (0x00000401)

### SOURCE_HDMI

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_HDMI
```

The input source is a device connected through HDMI-based bus. The key comes in through HDMI-CEC or MHL signal line, and is treated as if it were generated by a locally connected DPAD or keyboard.

<br />

Constant Value: 33554433 (0x02000001)

### SOURCE_JOYSTICK

Added in [API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_JOYSTICK
```

The input source is a joystick. (It may also be a `https://developer.android.com/reference/android/view/InputDevice#SOURCE_GAMEPAD`).

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_JOYSTICK`

Constant Value: 16777232 (0x01000010)

### SOURCE_KEYBOARD

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_KEYBOARD
```

The input source is a keyboard. This source indicates pretty much anything that has buttons. Use `https://developer.android.com/reference/android/view/InputDevice#getKeyboardType()` to determine whether the keyboard has alphabetic keys and can be used to enter text.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_BUTTON`

Constant Value: 257 (0x00000101)

### SOURCE_MOUSE

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_MOUSE
```

The input source is a mouse pointing device.

This value is also used for other indirect pointing devices (that is, where the device or finger is not in the same physical location as the pointer on the screen), specifically:

- touchpads, which will return `SOURCE_MOUSE | SOURCE_TOUCHPAD` from `https://developer.android.com/reference/android/view/InputDevice#getSources()`, but only `SOURCE_MOUSE` from `https://developer.android.com/reference/android/view/MotionEvent#getSource()` (see `https://developer.android.com/reference/android/view/MotionEvent#getSource()` for details);
- external drawing tablets, which use it in combination with `https://developer.android.com/reference/android/view/InputDevice#SOURCE_STYLUS`; and
- other mouse-like pointing devices such as pointing sticks.

<br />

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_POINTER`

Constant Value: 8194 (0x00002002)

### SOURCE_MOUSE_RELATIVE

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_MOUSE_RELATIVE
```

The input source is a mouse device whose relative motions should be interpreted as navigation events.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_TRACKBALL`

Constant Value: 131076 (0x00020004)

### SOURCE_ROTARY_ENCODER

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_ROTARY_ENCODER
```

The input source is a rotating encoder device whose motions should be interpreted as akin to those of a scroll wheel.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_NONE`

Constant Value: 4194304 (0x00400000)

### SOURCE_SENSOR

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_SENSOR
```

The input source is a sensor associated with the input device.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_NONE`

Constant Value: 67108864 (0x04000000)

### SOURCE_STYLUS

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_STYLUS
```

The input source is a stylus pointing device.

Note that this bit merely indicates that an input device is capable of obtaining input from a stylus. To determine whether a given touch event was produced by a stylus, examine the tool type returned by `https://developer.android.com/reference/android/view/MotionEvent#getToolType(int)` for each individual pointer.

A single touch event may multiple pointers with different tool types, such as an event that has one pointer with tool type `https://developer.android.com/reference/android/view/MotionEvent#TOOL_TYPE_FINGER` and another pointer with tool type `https://developer.android.com/reference/android/view/MotionEvent#TOOL_TYPE_STYLUS`. So it is important to examine the tool type of each pointer, regardless of the source reported by `https://developer.android.com/reference/android/view/MotionEvent#getSource()`.

<br />

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_POINTER`

Constant Value: 16386 (0x00004002)

### SOURCE_TOUCHPAD

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_TOUCHPAD
```

The input source is a touchpad (also known as a trackpad).

Touchpads will return `SOURCE_MOUSE | SOURCE_TOUCHPAD` from `https://developer.android.com/reference/android/view/InputDevice#getSources()`

**Note:** instead of `SOURCE_TOUCHPAD`, **`https://developer.android.com/reference/android/view/MotionEvent#getSource()` will normally return only `https://developer.android.com/reference/android/view/InputDevice#SOURCE_MOUSE`** for events from touchpads. See `https://developer.android.com/reference/android/view/MotionEvent#getSource()` for more details.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_POSITION`

Constant Value: 1048584 (0x00100008)

### SOURCE_TOUCHSCREEN

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_TOUCHSCREEN
```

The input source is a touch screen pointing device.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_POINTER`

Constant Value: 4098 (0x00001002)

### SOURCE_TOUCH_NAVIGATION

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_TOUCH_NAVIGATION
```

The input source is a touch device whose motions should be interpreted as navigation events. For example, an upward swipe should be as an upward focus traversal in the same manner as pressing up on a D-Pad would be. Swipes to the left, right and down should be treated in a similar manner.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_NONE`

Constant Value: 2097152 (0x00200000)

### SOURCE_TRACKBALL

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_TRACKBALL
```

The input source is a trackball.

<br />

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_TRACKBALL`

Constant Value: 65540 (0x00010004)

### SOURCE_UNKNOWN

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SOURCE_UNKNOWN
```

The input source is unknown.

<br />

Constant Value: 0 (0x00000000)

## Fields

### CREATOR

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Creator<InputDevice> CREATOR
```

<br />

<br />

## Public methods

### describeContents

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`, the return value of this method must include the `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### getAssociatedDisplayId

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getAssociatedDisplayId ()
```

Returns the associated display id of this input device.

<br />

| Returns ||
|---|---|
| `int` | the associated display id, or `https://developer.android.com/reference/android/view/Display#INVALID_DISPLAY` if the input device is not associated with a display. <br /> |

### getBatteryState

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public BatteryState getBatteryState ()
```

Gets the battery state object associated with the device, if there is one. Even if the device does not have a battery, the result is never null. Use `https://developer.android.com/reference/android/hardware/BatteryState#isPresent()` to determine whether a battery is present.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/hardware/BatteryState` | The battery object associated with the device, never null. <br /> |

### getControllerNumber

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getControllerNumber ()
```

The controller number for a given input device.

Each gamepad or joystick is given a unique, positive controller number when initially configured by the system. This number may change due to events such as device disconnects / reconnects or user initiated reassignment. Any change in number will trigger an event that can be observed by registering an `https://developer.android.com/reference/android/hardware/input/InputManager.InputDeviceListener`.

All input devices which are not gamepads or joysticks will be assigned a controller number of 0.

<br />

<br />

| Returns ||
|---|---|
| `int` | The controller number of the device. <br /> |

### getDescriptor

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getDescriptor ()
```

Gets the input device descriptor, which is a stable identifier for an input device.

An input device descriptor uniquely identifies an input device. Its value is intended to be persistent across system restarts, and should not change even if the input device is disconnected, reconnected or reconfigured at any time.

It is possible for there to be multiple `https://developer.android.com/reference/android/view/InputDevice` instances that have the same input device descriptor. This might happen in situations where a single human input device registers multiple `https://developer.android.com/reference/android/view/InputDevice` instances (HID collections) that describe separate features of the device, such as a keyboard that also has a touchpad. Alternately, it may be that the input devices are simply indistinguishable, such as two keyboards made by the same manufacturer.

The input device descriptor returned by `https://developer.android.com/reference/android/view/InputDevice#getDescriptor()` should only be used when an application needs to remember settings associated with a particular input device. For all other purposes when referring to a logical `https://developer.android.com/reference/android/view/InputDevice` instance at runtime use the id returned by `https://developer.android.com/reference/android/view/InputDevice#getId()`.

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The input device descriptor. <br /> |

### getDevice

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static InputDevice getDevice (int id)
```

Gets information about the input device with the specified id.

<br />

| Parameters ||
|---|---|
| `id` | `int`: The device id. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/InputDevice` | The input device or null if not found. <br /> |

### getDeviceIds

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int[] getDeviceIds ()
```

Gets the ids of all input devices in the system.

<br />

| Returns ||
|---|---|
| `int[]` | The input device ids. <br /> |

### getId

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getId ()
```

Gets the input device id.

Each input device receives a unique id when it is first configured by the system. The input device id may change when the system is restarted or if the input device is disconnected, reconnected or reconfigured at any time. If you require a stable identifier for a device that persists across boots and reconfigurations, use `https://developer.android.com/reference/android/view/InputDevice#getDescriptor()`.

<br />

<br />

| Returns ||
|---|---|
| `int` | The input device id. <br /> |

### getKeyCharacterMap

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public KeyCharacterMap getKeyCharacterMap ()
```

Gets the key character map associated with this input device.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/KeyCharacterMap` | The key character map. <br /> |

### getKeyCodeForKeyLocation

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getKeyCodeForKeyLocation (int locationKeyCode)
```

Gets the `https://developer.android.com/reference/android/view/KeyEvent` produced by the given location on a reference QWERTY keyboard layout.

This API is useful for querying the physical location of keys that change the character produced based on the current locale and keyboard layout.

The following table provides a non-exhaustive list of examples:

| Active Keyboard Layout | Input Parameter | Return Value |
|---|---|---|
| French AZERTY | `` `https://developer.android.com/reference/android/view/KeyEvent#KEYCODE_Q` `` | `` `https://developer.android.com/reference/android/view/KeyEvent#KEYCODE_A` `` |
| German QWERTZ | `` `https://developer.android.com/reference/android/view/KeyEvent#KEYCODE_Y` `` | `` `https://developer.android.com/reference/android/view/KeyEvent#KEYCODE_Z` `` |
| US QWERTY | `` `https://developer.android.com/reference/android/view/KeyEvent#KEYCODE_B` `` | `` `https://developer.android.com/reference/android/view/KeyEvent#KEYCODE_B` `` |

<br />

<br />

| Parameters ||
|---|---|
| `locationKeyCode` | `int`: The location of a key specified as a key code on the QWERTY layout. This provides a consistent way of referring to the physical location of a key independently of the current keyboard layout. Also see the [hypothetical keyboard](https://www.w3.org/TR/2017/CR-uievents-code-20170601/#key-alphanumeric-writing-system) provided by the W3C, which may be helpful for identifying the physical location of a key. <br /> |

| Returns ||
|---|---|
| `int` | The key code produced by the key at the specified location, given the current keyboard layout. Returns `https://developer.android.com/reference/android/view/KeyEvent#KEYCODE_UNKNOWN` if the device does not specify `https://developer.android.com/reference/android/view/InputDevice#SOURCE_KEYBOARD` or the requested mapping cannot be determined. <br /> |

### getKeyboardType

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getKeyboardType ()
```

Gets the keyboard type.

<br />

| Returns ||
|---|---|
| `int` | The keyboard type. <br /> |

### getLightsManager

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LightsManager getLightsManager ()
```

Gets the lights manager associated with the device, if there is one. Even if the device does not have lights, the result is never null. Use `https://developer.android.com/reference/android/hardware/lights/LightsManager#getLights()` to determine whether any lights is present.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/hardware/lights/LightsManager` | The lights manager associated with the device, never null. <br /> |

### getMotionRange

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public InputDevice.MotionRange getMotionRange (int axis)
```

Gets information about the range of values for a particular `https://developer.android.com/reference/android/view/MotionEvent` axis. If the device supports multiple sources, the same axis may have different meanings for each source. Returns information about the first axis found for any source. To obtain information about the axis for a specific source, use `https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int,%20int)`.

<br />

| Parameters ||
|---|---|
| `axis` | `int`: The axis constant. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/InputDevice.MotionRange` | The range of values, or null if the requested axis is not supported by the device. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MotionEvent#AXIS_X`
- `https://developer.android.com/reference/android/view/MotionEvent#AXIS_Y`

### getMotionRange

Added in [API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public InputDevice.MotionRange getMotionRange (int axis, 
                int source)
```

Gets information about the range of values for a particular `https://developer.android.com/reference/android/view/MotionEvent` axis used by a particular source on the device. If the device supports multiple sources, the same axis may have different meanings for each source.

<br />

| Parameters ||
|---|---|
| `axis` | `int`: The axis constant. <br /> |
| `source` | `int`: The source for which to return information. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/InputDevice.MotionRange` | The range of values, or null if the requested axis is not supported by the device. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MotionEvent#AXIS_X`
- `https://developer.android.com/reference/android/view/MotionEvent#AXIS_Y`

### getMotionRanges

Added in [API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<InputDevice.MotionRange> getMotionRanges ()
```

Gets the ranges for all axes supported by the device.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/view/InputDevice.MotionRange>` | The motion ranges for the device. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/InputDevice#getMotionRange(int,%20int)`

### getName

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getName ()
```

Gets the name of this input device.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The input device name. <br /> |

### getProductId

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getProductId ()
```

Gets the product id for the given device, if available.

A product id uniquely identifies which product within the address space of a given vendor, identified by the device's vendor id. A value of 0 will be assigned where a product id is not available.

<br />

<br />

| Returns ||
|---|---|
| `int` | The product id of a given device <br /> |

### getSensorManager

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public SensorManager getSensorManager ()
```

Gets the sensor manager service associated with the input device. Even if the device does not have a sensor, the result is never null. Use `https://developer.android.com/reference/android/hardware/SensorManager#getSensorList(int)` to get a full list of all supported sensors. Note that the sensors associated with the device may be different from the system sensors, as typically they are builtin sensors physically attached to input devices.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/hardware/SensorManager` | The sensor manager service associated with the device, never null. <br /> |

### getSources

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getSources ()
```

Gets the input sources supported by this input device as a combined bitfield.

<br />

| Returns ||
|---|---|
| `int` | The supported input sources. <br /> |

### getVendorId

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getVendorId ()
```

Gets the vendor id for the given device, if available.

A vendor id uniquely identifies the company who manufactured the device. A value of 0 will be assigned where a vendor id is not available.

<br />

<br />

| Returns ||
|---|---|
| `int` | The vendor id of a given device <br /> |

### getVibrator

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Vibrator getVibrator ()
```

<br />

**This method was deprecated in API level 31.**   

Use `https://developer.android.com/reference/android/view/InputDevice#getVibratorManager()` to retrieve the default device vibrator.

Gets the vibrator service associated with the device, if there is one. Even if the device does not have a vibrator, the result is never null. Use `https://developer.android.com/reference/android/os/Vibrator#hasVibrator()` to determine whether a vibrator is present. Note that the vibrator associated with the device may be different from the system vibrator. To obtain an instance of the system vibrator instead, call `https://developer.android.com/reference/android/content/Context#getSystemService(java.lang.Class<T>)` with `https://developer.android.com/reference/android/content/Context#VIBRATOR_SERVICE` as argument.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/Vibrator` | The vibrator service associated with the device, never null. <br /> |

### getVibratorManager

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public VibratorManager getVibratorManager ()
```

Gets the vibrator manager associated with the device. Even if the device does not have a vibrator manager, the result is never null. Use `https://developer.android.com/reference/android/os/VibratorManager#getVibratorIds()` to determine whether any vibrator is present.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/VibratorManager` | The vibrator manager associated with the device, never null. <br /> |

### hasKeys

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean[] hasKeys (int... keys)
```

Gets whether the device is capable of producing the list of keycodes.

<br />

| Parameters ||
|---|---|
| `keys` | `int`: The list of android keycodes to check for. <br /> |

| Returns ||
|---|---|
| `boolean[]` | An array of booleans where each member specifies whether the device is capable of generating the keycode given by the corresponding value at the same index in the keys array. <br /> |

### hasMicrophone

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean hasMicrophone ()
```

Reports whether the device has a built-in microphone.

<br />

| Returns ||
|---|---|
| `boolean` | Whether the device has a built-in microphone. <br /> |

### isEnabled

Added in [API level 27](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isEnabled ()
```

Returns true if input device is enabled.

<br />

| Returns ||
|---|---|
| `boolean` | Whether the input device is enabled. <br /> |

### isExternal

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isExternal ()
```

Returns true if the device is external (connected to USB or Bluetooth or some other peripheral bus), otherwise it is built-in.

<br />

| Returns ||
|---|---|
| `boolean` | True if the device is external. <br /> |

### isVirtual

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isVirtual ()
```

Returns true if the device is a virtual input device rather than a real one, such as the virtual keyboard (see `https://developer.android.com/reference/android/view/KeyCharacterMap#VIRTUAL_KEYBOARD`).

Virtual input devices are provided to implement system-level functionality and should not be seen or configured by users.

<br />

<br />

| Returns ||
|---|---|
| `boolean` | True if the device is virtual. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/KeyCharacterMap#VIRTUAL_KEYBOARD`

### supportsSource

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean supportsSource (int source)
```

Determines whether the input device supports the given source or sources.

<br />

| Parameters ||
|---|---|
| `source` | `int`: The input source or sources to check against. This can be a generic device type such as `https://developer.android.com/reference/android/view/InputDevice#SOURCE_MOUSE`, a more generic device class, such as `https://developer.android.com/reference/android/view/InputDevice#SOURCE_CLASS_POINTER`, or a combination of sources bitwise ORed together. <br /> |

| Returns ||
|---|---|
| `boolean` | Whether the device can produce all of the given sources. <br /> |

### toString

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |

### writeToParcel

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void writeToParcel (Parcel out, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

| Parameters ||
|---|---|
| `out` | `Parcel`: The Parcel in which the object should be written. This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |