Skip to main content
Version: 21 Aug 2024

Power Manager Overview

Power Manager provides a set of power management APIs that allow applications to receive callbacks when the power state changes, APIs to get device components power state and properties, and to set the controller’s power states.

These APIs allow an application to function differently depending on its power needs. For example an application might use this API to put the controller in the idle state if the input mode is hand-tracking only.

Controller Power States:

ComponentPower StateDescription
ControllerNormalController is active
Disabled While ChargingCertain SKUs cannot use controller while charging
StandbyController is turned on but inactive, press home button to switch to active manually
SleepNot supported for this component

📄️ API Overview

This guide provides detailed instructions and examples on how to use the MagicLeap's MLPowerManager API for managing power states and properties of components in Unity. The guide first explains the concept of power states, showing how to get all available states and retrieve a specific state for a device. It then delves into the process of setting a power state with thorough examples. The guide proceeds to explain how to get and update the properties of a component, focusing on different aspects like battery info, battery level, charging state, and connection state. Lastly, it touches on how to handle power management events such as errors, state changes, and property changes through callbacks. By following this guide, developers can efficiently control and manage Magic Leap 2's power states and properties inside their Unity Application.

📄️ Power Manager Example

This example demonstrates how to manage power states and properties on a device using the Magic Leap platform's Power Manager API. It includes initialization and setup of available power states and properties, reading current power state and properties, and setting a new power state. The code also handles different events that could occur during these operations, such as changes in power state or properties, and potential errors. The detailed logging provides real-time insight into the power management process.