capacitor-thermal-state

March 18, 2026 · View on GitHub

Monitor device thermal state (overheating detection) for Capacitor apps. Works on iOS and Android. No configuration needed.

Install

npm install capacitor-thermal-state
npx cap sync

Usage

import { ThermalState } from 'capacitor-thermal-state'

// Get current state
const { state, headroom } = await ThermalState.getState()
// state: 'nominal' | 'fair' | 'serious' | 'critical' | 'unknown'
// headroom: 0.0–1.0 (Android API 31+) or null

// Listen for changes
const listener = await ThermalState.addListener(
  'thermalStateChange',
  ({ state, headroom }) => {
    if (state === 'serious') reduceLoad()
    if (state === 'critical') stopHeavyWork()
  }
)

// Remove listener
await listener.remove()

// Simulate heat for testing
await ThermalState.simulateHeat()

Thermal states

StateMeaningRecommended action
nominalDevice is coolFull performance OK
fairSlightly warm, no throttlingMonitor situation
seriousHot, system reducing performanceReduce load
criticalVery hot, heavy throttlingStop all heavy operations
unknownWeb platform or old Android

API

getState()

Returns the current thermal state of the device.

getState(): Promise<ThermalStateResult>

simulateHeat()

Simulates a thermal state change event for testing purposes. Fires a thermalStateChange event with state serious.

simulateHeat(): Promise<void>

addListener('thermalStateChange', handler)

Listen for thermal state changes in real time.

addListener(
  eventName: 'thermalStateChange',
  listenerFunc: (state: ThermalStateResult) => void
): Promise<PluginListenerHandle>

removeAllListeners()

Remove all listeners for this plugin.

Interfaces

ThermalStateResult

PropertyTypeDescription
stateThermalStateValueCurrent thermal state
headroomnumber | nullThermal headroom 0.0–1.0, Android API 31+ only

Platform support

PlatformSupportedNotes
AndroidAPI 29+ for state, API 31+ for headroom
iOSiOS 11+
Web⚠️Always returns unknown