# BatteryState

Artifact: [androidx.xr.projected:projected](https://developer.android.com/jetpack/androidx/releases/xr-projected) [View Source](https://cs.android.com/search?q=file:androidx/xr/projected/BatteryState.kt+class:androidx.xr.projected.BatteryState) Added in [1.0.0-alpha14](https://developer.android.com/jetpack/androidx/releases/xr-projected#1.0.0-alpha14)

*** ** * ** ***


```
public final class BatteryState
```

<br />

*** ** * ** ***

Information about the battery state of the projected device.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/xr/projected/BatteryState#BatteryState(kotlin.Boolean,kotlin.Int)( boolean isCharging, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0, to = 100) int batteryLevel )` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/xr/projected/BatteryState#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final int` | `https://developer.android.com/reference/androidx/xr/projected/BatteryState#getBatteryLevel()()` the current battery level, from 0 to 100 inclusive |
| `int` | `https://developer.android.com/reference/androidx/xr/projected/BatteryState#hashCode()()` |
| `final boolean` | `https://developer.android.com/reference/androidx/xr/projected/BatteryState#isCharging()()` true if the battery is currently charging, false otherwise |

## Public constructors

### BatteryState

Added in [1.0.0-alpha14](https://developer.android.com/jetpack/androidx/releases/xr-projected#1.0.0-alpha14)

```
public BatteryState(
    boolean isCharging,
    @IntRange(from = 0, to = 100) int batteryLevel
)
```

## Public methods

### equals

```
public boolean equals(Object other)
```

### getBatteryLevel

Added in [1.0.0-alpha14](https://developer.android.com/jetpack/androidx/releases/xr-projected#1.0.0-alpha14)

```
public final int getBatteryLevel()
```

the current battery level, from 0 to 100 inclusive

### hashCode

```
public int hashCode()
```

### isCharging

Added in [1.0.0-alpha14](https://developer.android.com/jetpack/androidx/releases/xr-projected#1.0.0-alpha14)

```
public final boolean isCharging()
```

true if the battery is currently charging, false otherwise