Skip to Content
defold-typescript libraries
defold (official)

defold/extension-adpf/adpf

Functions and constants for interacting with the Android Device Performance Framework

  • GitHub: defold/extension-adpf — pinned to 5d64f02
    1. This repo publishes no releases or tags. Add a commit archive URL — for the pinned commit, https://github.com/defold/extension-adpf/archive/5d64f0249109295d3019e457c5228806050ee871.zip — to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as adpf from "adpf"

Functions

adpf.hint.initialize(target_fps_nanos: number): boolean

Initialise performance hints

Parameters

  • target_fps_nanos: number

Returns

  • available: boolean — Return true if the PerformanceHintManager API is available on the device

adpf.hint.update_target_fps(target_fps_nanos: number)

Update the target fps

Parameters

  • target_fps_nanos: number

adpf.thermal.initialize(available: boolean)

Initialise thermal

Parameters

  • available: boolean — Return true if the Thermal API is available on the device

adpf.thermal.get_headroom(forecast_seconds: number): number

Provides an estimate of how much thermal headroom the device currently has before hitting severe throttling.

Parameters

  • forecast_seconds: number — how many seconds in the future to forecast

Returns

  • headroom: number — a value greater than or equal to 0.0 where 1.0 indicates the SEVERE throttling threshold

adpf.thermal.get_status(): number

Get the current thermal status of the device

Returns

  • status: number — The current thermal status of the device. One of THERMAL_STATUS_XYZ.

Constants

adpf.thermal.THERMAL_STATUS_CRITICAL

Platform has done everything to reduce power.

adpf.thermal.THERMAL_STATUS_EMERGENCY

Key components in platform are shutting down due to thermal condition.

adpf.thermal.THERMAL_STATUS_LIGHT

Light throttling where UX is not impacted.

adpf.thermal.THERMAL_STATUS_MODERATE

Moderate throttling where UX is not largely impacted.

adpf.thermal.THERMAL_STATUS_NONE

Not under throttling.

adpf.thermal.THERMAL_STATUS_SEVERE

Severe throttling where UX is largely impacted.

adpf.thermal.THERMAL_STATUS_SHUTDOWN

Need shutdown immediately

On this page