Battery

Pre-requisite: The user has to be signed in to perform the following operations.

Is this a battery camera

A camera’s power source decides how it behaves when idle and how carefully the app should use it:

if (device.hasBattery()) {
  // show the battery indicator
}

hasBattery() is true for PowerSource.Battery and PowerSource.ACAndBattery — a camera that can run on mains but has a battery to fall back on still counts. PowerSource.AC is the only value that does not.

device.isLowResourceDevice() is the broader check the SDK itself uses: true for battery cameras and 4G cameras, the two cases where an unattended stream costs the user something.


Reading the level

The charge level and charging state live on the device record:

val percentage = device.deviceState.batteryPercentage
val isCharging = device.deviceState.charging

batteryPercentage is an Int; charging is a nullable Boolean, so treat null as unknown rather than as “not charging”.

These are a snapshot taken when the device record was fetched, not a live flow. Nothing pushes an updated level while a stream is running, so refresh them by re-fetching the camera — see Device Retrieval and Information.


Sleep

An idle battery camera reports DeviceStatus.SLEEP rather than OFFLINE. A sleeping camera is reachable; an offline one is not, so do not treat the two the same when deciding whether to offer live view.

The SDK wakes a sleeping camera for you rather than making the app do it:

Action What wakes the camera
Live view Creating the LiveStreamClient
Two-way call initiateVideoCall, before the request is sent
SD card playback keepAlive(), sent for cameras where device.hasBattery()

Not draining it

A stream nobody is watching keeps the radio and sensor awake. Set autoDisconnectAfter when creating the client so an unattended stream ends on its own, and use disableAutoDisconnect() / enableAutoDisconnect() to pause the timer only while the user is actively interacting.

See Live View for the client options and Trail for cameras where the cellular data pool drains alongside the battery.


This site uses Just the Docs, a documentation theme for Jekyll.