Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/mtp/MtpEvent#constants) \| [Methods](https://developer.android.com/reference/android/mtp/MtpEvent#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/mtp/MtpEvent#inhmethods)

# MtpEvent

*** ** * ** ***

` public class MtpEvent `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

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

<br />

*** ** * ** ***

This class encapsulates information about a MTP event. This corresponds to the events described in appendix G of the MTP specification.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_CANCEL_TRANSACTION` Event code for CANCEL_TRANSACTION event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_CAPTURE_COMPLETE` Event code for CAPTURE_COMPLETE event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_DEVICE_INFO_CHANGED` Event code for DEVICE_INFO_CHANGED event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_DEVICE_PROP_CHANGED` Event code for DEVICE_PROP_CHANGED event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_DEVICE_RESET` Event code for DEVICE_RESET event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_OBJECT_ADDED` Event code for OBJECT_ADDED event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_OBJECT_INFO_CHANGED` Event code for OBJECT_INFO_CHANGED event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_OBJECT_PROP_CHANGED` Event code for OBJECT_PROP_CHANGED event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_OBJECT_PROP_DESC_CHANGED` Event code for OBJECT_PROP_DESC_CHANGED event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_OBJECT_REFERENCES_CHANGED` Event code for OBJECT_REFERENCES_CHANGED event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_OBJECT_REMOVED` Event code for OBJECT_REMOVED event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_REQUEST_OBJECT_TRANSFER` Event code for REQUEST_OBJECT_TRANSFER event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_STORAGE_INFO_CHANGED` Event code for STORAGE_INFO_CHANGED event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_STORE_ADDED` Event code for STORE_ADDED event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_STORE_FULL` Event code for STORE_FULL event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_STORE_REMOVED` Event code for STORE_REMOVED event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_UNDEFINED` Event code for UNDEFINED event |
| `int` | `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_UNREPORTED_STATUS` Event code for UNREPORTED_STATUS event |

| ### Public methods ||
|---|---|
| ` int` | ` https://developer.android.com/reference/android/mtp/MtpEvent#getDevicePropCode()() ` Obtains devicePropCode event parameter. |
| ` int` | ` https://developer.android.com/reference/android/mtp/MtpEvent#getEventCode()() ` Returns event code of MTP event. |
| ` int` | ` https://developer.android.com/reference/android/mtp/MtpEvent#getObjectFormatCode()() ` Obtains objectFormatCode event parameter. |
| ` int` | ` https://developer.android.com/reference/android/mtp/MtpEvent#getObjectHandle()() ` Obtains objectHandle event parameter. |
| ` int` | ` https://developer.android.com/reference/android/mtp/MtpEvent#getObjectPropCode()() ` Obtains objectPropCode event parameter. |
| ` int` | ` https://developer.android.com/reference/android/mtp/MtpEvent#getParameter1()() ` Obtains the first event parameter. |
| ` int` | ` https://developer.android.com/reference/android/mtp/MtpEvent#getParameter2()() ` Obtains the second event parameter. |
| ` int` | ` https://developer.android.com/reference/android/mtp/MtpEvent#getParameter3()() ` Obtains the third event parameter. |
| ` int` | ` https://developer.android.com/reference/android/mtp/MtpEvent#getStorageId()() ` Obtains storageID event parameter. |
| ` int` | ` https://developer.android.com/reference/android/mtp/MtpEvent#getTransactionId()() ` Obtains transactionID event parameter. |

### 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*.

## Constants

### EVENT_CANCEL_TRANSACTION

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

```
public static final int EVENT_CANCEL_TRANSACTION
```

Event code for CANCEL_TRANSACTION event

<br />

Constant Value: 16385 (0x00004001)

### EVENT_CAPTURE_COMPLETE

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

```
public static final int EVENT_CAPTURE_COMPLETE
```

Event code for CAPTURE_COMPLETE event

<br />

Constant Value: 16397 (0x0000400d)

### EVENT_DEVICE_INFO_CHANGED

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

```
public static final int EVENT_DEVICE_INFO_CHANGED
```

Event code for DEVICE_INFO_CHANGED event

<br />

Constant Value: 16392 (0x00004008)

### EVENT_DEVICE_PROP_CHANGED

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

```
public static final int EVENT_DEVICE_PROP_CHANGED
```

Event code for DEVICE_PROP_CHANGED event

<br />

Constant Value: 16390 (0x00004006)

### EVENT_DEVICE_RESET

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

```
public static final int EVENT_DEVICE_RESET
```

Event code for DEVICE_RESET event

<br />

Constant Value: 16395 (0x0000400b)

### EVENT_OBJECT_ADDED

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

```
public static final int EVENT_OBJECT_ADDED
```

Event code for OBJECT_ADDED event

<br />

Constant Value: 16386 (0x00004002)

### EVENT_OBJECT_INFO_CHANGED

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

```
public static final int EVENT_OBJECT_INFO_CHANGED
```

Event code for OBJECT_INFO_CHANGED event

<br />

Constant Value: 16391 (0x00004007)

### EVENT_OBJECT_PROP_CHANGED

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

```
public static final int EVENT_OBJECT_PROP_CHANGED
```

Event code for OBJECT_PROP_CHANGED event

<br />

Constant Value: 51201 (0x0000c801)

### EVENT_OBJECT_PROP_DESC_CHANGED

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

```
public static final int EVENT_OBJECT_PROP_DESC_CHANGED
```

Event code for OBJECT_PROP_DESC_CHANGED event

<br />

Constant Value: 51202 (0x0000c802)

### EVENT_OBJECT_REFERENCES_CHANGED

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

```
public static final int EVENT_OBJECT_REFERENCES_CHANGED
```

Event code for OBJECT_REFERENCES_CHANGED event

<br />

Constant Value: 51203 (0x0000c803)

### EVENT_OBJECT_REMOVED

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

```
public static final int EVENT_OBJECT_REMOVED
```

Event code for OBJECT_REMOVED event

<br />

Constant Value: 16387 (0x00004003)

### EVENT_REQUEST_OBJECT_TRANSFER

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

```
public static final int EVENT_REQUEST_OBJECT_TRANSFER
```

Event code for REQUEST_OBJECT_TRANSFER event

<br />

Constant Value: 16393 (0x00004009)

### EVENT_STORAGE_INFO_CHANGED

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

```
public static final int EVENT_STORAGE_INFO_CHANGED
```

Event code for STORAGE_INFO_CHANGED event

<br />

Constant Value: 16396 (0x0000400c)

### EVENT_STORE_ADDED

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

```
public static final int EVENT_STORE_ADDED
```

Event code for STORE_ADDED event

<br />

Constant Value: 16388 (0x00004004)

### EVENT_STORE_FULL

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

```
public static final int EVENT_STORE_FULL
```

Event code for STORE_FULL event

<br />

Constant Value: 16394 (0x0000400a)

### EVENT_STORE_REMOVED

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

```
public static final int EVENT_STORE_REMOVED
```

Event code for STORE_REMOVED event

<br />

Constant Value: 16389 (0x00004005)

### EVENT_UNDEFINED

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

```
public static final int EVENT_UNDEFINED
```

Event code for UNDEFINED event

<br />

Constant Value: 16384 (0x00004000)

### EVENT_UNREPORTED_STATUS

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

```
public static final int EVENT_UNREPORTED_STATUS
```

Event code for UNREPORTED_STATUS event

<br />

Constant Value: 16398 (0x0000400e)

## Public methods

### getDevicePropCode

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

```
public int getDevicePropCode ()
```

Obtains devicePropCode event parameter.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_DEVICE_PROP_CHANGED`

### getEventCode

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

```
public int getEventCode ()
```

Returns event code of MTP event. See the USB-IF MTP specification for the details of event constants.

<br />

| Returns ||
|---|---|
| `int` | event code <br /> |

### getObjectFormatCode

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

```
public int getObjectFormatCode ()
```

Obtains objectFormatCode event parameter.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_OBJECT_PROP_DESC_CHANGED`

### getObjectHandle

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

```
public int getObjectHandle ()
```

Obtains objectHandle event parameter.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_OBJECT_ADDED`
- `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_OBJECT_REMOVED`
- `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_OBJECT_INFO_CHANGED`
- `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_REQUEST_OBJECT_TRANSFER`
- `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_OBJECT_PROP_CHANGED`
- `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_OBJECT_REFERENCES_CHANGED`

### getObjectPropCode

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

```
public int getObjectPropCode ()
```

Obtains objectPropCode event parameter.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_OBJECT_PROP_CHANGED`
- `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_OBJECT_PROP_DESC_CHANGED`

### getParameter1

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

```
public int getParameter1 ()
```

Obtains the first event parameter.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### getParameter2

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

```
public int getParameter2 ()
```

Obtains the second event parameter.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### getParameter3

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

```
public int getParameter3 ()
```

Obtains the third event parameter.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### getStorageId

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

```
public int getStorageId ()
```

Obtains storageID event parameter.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_STORE_ADDED`
- `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_STORE_REMOVED`
- `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_STORE_FULL`
- `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_STORAGE_INFO_CHANGED`

### getTransactionId

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

```
public int getTransactionId ()
```

Obtains transactionID event parameter.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/mtp/MtpEvent#EVENT_CAPTURE_COMPLETE`