# UsageEvents.Event

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

# Event

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/app/usage/UsageEvents.Event "View this page in Java")  

```
class Event
```

|---|----------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                             ||
| ↳ | [android.app.usage.UsageEvents.Event](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#) |

An event representing a state change for a component.

## Summary

|                                                                                                                                                                                                          Constants                                                                                                                                                                                                           ||
|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ACTIVITY_PAUSED](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#ACTIVITY_PAUSED:kotlin.Int) An event type denoting that an[android.app.Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)moved to the background.                                                   |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ACTIVITY_RESUMED](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#ACTIVITY_RESUMED:kotlin.Int) An event type denoting that an[android.app.Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)moved to the foreground.                                                 |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [ACTIVITY_STOPPED](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#ACTIVITY_STOPPED:kotlin.Int) An activity becomes invisible on the UI, corresponding to[android.app.Activity#onStop()](https://developer.android.com/reference/kotlin/android/app/Activity.html#onStop())of the activity's lifecycle. |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [CONFIGURATION_CHANGE](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#CONFIGURATION_CHANGE:kotlin.Int) An event type denoting that the device configuration has changed.                                                                                                                               |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [DEVICE_SHUTDOWN](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#DEVICE_SHUTDOWN:kotlin.Int) An event type denoting that the Android runtime underwent a shutdown process.                                                                                                                             |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [DEVICE_STARTUP](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#DEVICE_STARTUP:kotlin.Int) An event type denoting that the Android runtime started up.                                                                                                                                                 |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [FOREGROUND_SERVICE_START](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#FOREGROUND_SERVICE_START:kotlin.Int) An event type denoting start of a foreground service.                                                                                                                                   |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [FOREGROUND_SERVICE_STOP](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#FOREGROUND_SERVICE_STOP:kotlin.Int) An event type denoting stop of a foreground service.                                                                                                                                      |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [KEYGUARD_HIDDEN](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#KEYGUARD_HIDDEN:kotlin.Int) An event type denoting that the screen's keyguard has been hidden.                                                                                                                                        |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [KEYGUARD_SHOWN](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#KEYGUARD_SHOWN:kotlin.Int) An event type denoting that the screen's keyguard has been shown, whether or not the screen is off.                                                                                                         |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [MOVE_TO_BACKGROUND](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#MOVE_TO_BACKGROUND:kotlin.Int) <br />                                                                                                                                                                                              |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [MOVE_TO_FOREGROUND](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#MOVE_TO_FOREGROUND:kotlin.Int) <br />                                                                                                                                                                                              |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [NONE](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#NONE:kotlin.Int) No event type.                                                                                                                                                                                                                  |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [SCREEN_INTERACTIVE](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#SCREEN_INTERACTIVE:kotlin.Int) An event type denoting that the screen has gone in to an interactive state (turned on for full user interaction, not ambient display or other non-interactive state).                               |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [SCREEN_NON_INTERACTIVE](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#SCREEN_NON_INTERACTIVE:kotlin.Int) An event type denoting that the screen has gone in to a non-interactive state (completely turned off or turned on only in a non-interactive state like ambient display).                    |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [SHORTCUT_INVOCATION](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#SHORTCUT_INVOCATION:kotlin.Int) An event type denoting that an action equivalent to a ShortcutInfo is taken by the user.                                                                                                          |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [STANDBY_BUCKET_CHANGED](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#STANDBY_BUCKET_CHANGED:kotlin.Int) An event type denoting a change in App Standby Bucket.                                                                                                                                      |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [USER_INTERACTION](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#USER_INTERACTION:kotlin.Int) An event type denoting that a package was interacted with in some way by the user.                                                                                                                      |

|                                                Public constructors                                                ||
|----------------------------------------------------------------------------------------------------------------|---|
| [Event](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#Event())`()` <br /> |

|                                                                                                                                                                                                                                                                                     Public methods                                                                                                                                                                                                                                                                                     ||
|----------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                               | [getAppStandbyBucket](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getAppStandbyBucket())`()` Returns the standby bucket of the app, if the event is of type[STANDBY_BUCKET_CHANGED](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#STANDBY_BUCKET_CHANGED:kotlin.Int), otherwise returns 0.                                                                                                       |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!                        | [getClassName](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getClassName())`()` The class name of the source of this event.                                                                                                                                                                                                                                                                                                            |
| [Configuration](https://developer.android.com/reference/kotlin/android/content/res/Configuration.html#)! | [getConfiguration](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getConfiguration())`()` Returns a[Configuration](https://developer.android.com/reference/kotlin/android/content/res/Configuration.html#)for this event if the event is of type[CONFIGURATION_CHANGE](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#CONFIGURATION_CHANGE:kotlin.Int), otherwise it returns null.                   |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                               | [getEventType](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getEventType())`()` The event type.                                                                                                                                                                                                                                                                                                                                        |
| [PersistableBundle](https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#)   | [getExtras](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getExtras())`()` Retrieves a map of extended data from the event if the event is of type[USER_INTERACTION](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#USER_INTERACTION:kotlin.Int).                                                                                                                                                   |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!                        | [getPackageName](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getPackageName())`()` The package name of the source of this event.                                                                                                                                                                                                                                                                                                      |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!                        | [getShortcutId](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getShortcutId())`()` Returns the ID of a[android.content.pm.ShortcutInfo](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.html#)for this event if the event is of type[SHORTCUT_INVOCATION](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#SHORTCUT_INVOCATION:kotlin.Int), otherwise it returns null. |
| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)                             | [getTimeStamp](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getTimeStamp())`()` The time at which this event occurred, measured in milliseconds since the epoch.                                                                                                                                                                                                                                                                       |

## Constants

### ACTIVITY_PAUSED

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

```
static val ACTIVITY_PAUSED: Int
```

An event type denoting that an[android.app.Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)moved to the background. This event has a package name and class name associated with it and can be retrieved using[getPackageName()](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getPackageName())and[getClassName()](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getClassName()). If a package has multiple activities, this event is reported for each activity that moves to background. This event is corresponding to[android.app.Activity#onPause()](https://developer.android.com/reference/kotlin/android/app/Activity.html#onPause())of the activity's lifecycle.  

    Value: 2

### ACTIVITY_RESUMED

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

```
static val ACTIVITY_RESUMED: Int
```

An event type denoting that an[android.app.Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html#)moved to the foreground. This event has a package name and class name associated with it and can be retrieved using[getPackageName()](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getPackageName())and[getClassName()](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getClassName()). If a package has multiple activities, this event is reported for each activity that moves to foreground. This event is corresponding to[android.app.Activity#onResume()](https://developer.android.com/reference/kotlin/android/app/Activity.html#onResume())of the activity's lifecycle.  

    Value: 1

### ACTIVITY_STOPPED

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

```
static val ACTIVITY_STOPPED: Int
```

An activity becomes invisible on the UI, corresponding to[android.app.Activity#onStop()](https://developer.android.com/reference/kotlin/android/app/Activity.html#onStop())of the activity's lifecycle.  

    Value: 23

### CONFIGURATION_CHANGE

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

```
static val CONFIGURATION_CHANGE: Int
```

An event type denoting that the device configuration has changed.  

    Value: 5

### DEVICE_SHUTDOWN

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

```
static val DEVICE_SHUTDOWN: Int
```

An event type denoting that the Android runtime underwent a shutdown process. A DEVICE_SHUTDOWN event should be treated as if all started activities and foreground services are now stopped and no explicit[ACTIVITY_STOPPED](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#ACTIVITY_STOPPED:kotlin.Int)and[FOREGROUND_SERVICE_STOP](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#FOREGROUND_SERVICE_STOP:kotlin.Int)events will be generated for them.

The DEVICE_SHUTDOWN timestamp is actually the last time UsageStats database is persisted before the actual shutdown. Events (if there are any) between this timestamp and the actual shutdown is not persisted in the database. So any open events without matching close events between DEVICE_SHUTDOWN and[DEVICE_STARTUP](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#DEVICE_STARTUP:kotlin.Int)should be ignored because the closing time is unknown.  

    Value: 26

### DEVICE_STARTUP

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

```
static val DEVICE_STARTUP: Int
```

An event type denoting that the Android runtime started up. This could be after a shutdown or a runtime restart. Any open events without matching close events between[DEVICE_SHUTDOWN](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#DEVICE_SHUTDOWN:kotlin.Int)and DEVICE_STARTUP should be ignored because the closing time is unknown.  

    Value: 27

### FOREGROUND_SERVICE_START

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

```
static val FOREGROUND_SERVICE_START: Int
```

An event type denoting start of a foreground service. This event has a package name and class name associated with it and can be retrieved using[getPackageName()](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getPackageName())and[getClassName()](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getClassName()). If a package has multiple foreground services, this event is reported for each service that is started.  

    Value: 19

### FOREGROUND_SERVICE_STOP

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

```
static val FOREGROUND_SERVICE_STOP: Int
```

An event type denoting stop of a foreground service. This event has a package name and class name associated with it and can be retrieved using[getPackageName()](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getPackageName())and[getClassName()](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getClassName()). If a package has multiple foreground services, this event is reported for each service that is stopped.  

    Value: 20

### KEYGUARD_HIDDEN

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

```
static val KEYGUARD_HIDDEN: Int
```

An event type denoting that the screen's keyguard has been hidden. This typically happens when the user unlocks their phone after turning it on.  

    Value: 18

### KEYGUARD_SHOWN

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

```
static val KEYGUARD_SHOWN: Int
```

An event type denoting that the screen's keyguard has been shown, whether or not the screen is off.  

    Value: 17

### MOVE_TO_BACKGROUND

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

```
static val MOVE_TO_BACKGROUND: Int
```

**Deprecated:** *by[ACTIVITY_PAUSED](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#ACTIVITY_PAUSED:kotlin.Int)*  

    Value: 2

### MOVE_TO_FOREGROUND

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

```
static val MOVE_TO_FOREGROUND: Int
```

**Deprecated:** *by[ACTIVITY_RESUMED](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#ACTIVITY_RESUMED:kotlin.Int)*  

    Value: 1

### NONE

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

```
static val NONE: Int
```

No event type.  

    Value: 0

### SCREEN_INTERACTIVE

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

```
static val SCREEN_INTERACTIVE: Int
```

An event type denoting that the screen has gone in to an interactive state (turned on for full user interaction, not ambient display or other non-interactive state).  

    Value: 15

### SCREEN_NON_INTERACTIVE

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

```
static val SCREEN_NON_INTERACTIVE: Int
```

An event type denoting that the screen has gone in to a non-interactive state (completely turned off or turned on only in a non-interactive state like ambient display).  

    Value: 16

### SHORTCUT_INVOCATION

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

```
static val SHORTCUT_INVOCATION: Int
```

An event type denoting that an action equivalent to a ShortcutInfo is taken by the user.  

    Value: 8

**See Also**

- [android.content.pm.ShortcutManager#reportShortcutUsed(String)](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutManager.html#reportShortcutUsed(kotlin.String))  

### STANDBY_BUCKET_CHANGED

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

```
static val STANDBY_BUCKET_CHANGED: Int
```

An event type denoting a change in App Standby Bucket. The new bucket can be retrieved by calling[getAppStandbyBucket()](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#getAppStandbyBucket()).  

    Value: 11

**See Also**

- [android.app.usage.UsageStatsManager#getAppStandbyBucket()](https://developer.android.com/reference/kotlin/android/app/usage/UsageStatsManager#getAppStandbyBucket())  

### USER_INTERACTION

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

```
static val USER_INTERACTION: Int
```

An event type denoting that a package was interacted with in some way by the user.  

    Value: 7

## Public constructors

### Event

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

```
Event()
```

## Public methods

### getAppStandbyBucket

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

```
fun getAppStandbyBucket(): Int
```

Returns the standby bucket of the app, if the event is of type[STANDBY_BUCKET_CHANGED](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#STANDBY_BUCKET_CHANGED:kotlin.Int), otherwise returns 0.

|                                                          Return                                                           ||
|----------------------------------------------------------------------------|-----------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | the standby bucket associated with the event. |

### getClassName

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

```
fun getClassName(): String!
```

The class name of the source of this event. This may be null for certain events.  

### getConfiguration

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

```
fun getConfiguration(): Configuration!
```

Returns a[Configuration](https://developer.android.com/reference/kotlin/android/content/res/Configuration.html#)for this event if the event is of type[CONFIGURATION_CHANGE](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#CONFIGURATION_CHANGE:kotlin.Int), otherwise it returns null.  

### getEventType

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

```
fun getEventType(): Int
```

The event type.  
**See Also**

- [#ACTIVITY_PAUSED](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#ACTIVITY_PAUSED:kotlin.Int)
- [#ACTIVITY_RESUMED](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#ACTIVITY_RESUMED:kotlin.Int)
- [#CONFIGURATION_CHANGE](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#CONFIGURATION_CHANGE:kotlin.Int)
- [#USER_INTERACTION](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#USER_INTERACTION:kotlin.Int)
- [#STANDBY_BUCKET_CHANGED](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#STANDBY_BUCKET_CHANGED:kotlin.Int)
- [#FOREGROUND_SERVICE_START](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#FOREGROUND_SERVICE_START:kotlin.Int)
- [#FOREGROUND_SERVICE_STOP](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#FOREGROUND_SERVICE_STOP:kotlin.Int)
- [#ACTIVITY_STOPPED](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#ACTIVITY_STOPPED:kotlin.Int)  

### getExtras

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

```
fun getExtras(): PersistableBundle
```

Retrieves a map of extended data from the event if the event is of type[USER_INTERACTION](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#USER_INTERACTION:kotlin.Int).

|                                                                                                                                                                                                                                                                                                                                                                                                                                           Return                                                                                                                                                                                                                                                                                                                                                                                                                                            ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PersistableBundle](https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#) | the map of all extras that associated with the reported user interaction event. The returned[PersistableBundle](https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#)will contain the extras[UsageStatsManager.EXTRA_EVENT_CATEGORY](https://developer.android.com/reference/kotlin/android/app/usage/UsageStatsManager#EXTRA_EVENT_CATEGORY:kotlin.String)and[UsageStatsManager.EXTRA_EVENT_ACTION](https://developer.android.com/reference/kotlin/android/app/usage/UsageStatsManager#EXTRA_EVENT_ACTION:kotlin.String).[PersistableBundle.EMPTY](https://developer.android.com/reference/kotlin/android/os/PersistableBundle.html#EMPTY:android.os.PersistableBundle)will be returned if the details are not available. This value cannot be`null`. |

### getPackageName

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

```
fun getPackageName(): String!
```

The package name of the source of this event.  

### getShortcutId

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

```
fun getShortcutId(): String!
```

Returns the ID of a[android.content.pm.ShortcutInfo](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.html#)for this event if the event is of type[SHORTCUT_INVOCATION](https://developer.android.com/reference/kotlin/android/app/usage/UsageEvents.Event#SHORTCUT_INVOCATION:kotlin.Int), otherwise it returns null.  
**See Also**

- [android.content.pm.ShortcutManager#reportShortcutUsed(String)](https://developer.android.com/reference/kotlin/android/content/pm/ShortcutManager.html#reportShortcutUsed(kotlin.String))  

### getTimeStamp

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

```
fun getTimeStamp(): Long
```

The time at which this event occurred, measured in milliseconds since the epoch.

<br />

See[System.currentTimeMillis()](https://developer.android.com/reference/kotlin/java/lang/System.html#currentTimeMillis()).  
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z.

|                                                                                       Return                                                                                       ||
|------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|
| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z. |