Android 支持两个图形 API:旧版 OpenGL ES API 和新版 Vulkan API。Vulkan 现在是 Android 上的主要图形 API,比 OpenGL ES 更高效。如需详细了解 Vulkan 的优势和使用方法,请参阅将 Vulkan 用于图形。
响应设备热状态
设备 CPU 和 GPU 的利用率过高会产生热量。随着设备发热,功率效率会降低。如果设备过热,系统会降低 CPU 和 GPU 的速度,以降低功耗并让设备降温。这种行为称为热节流,会影响游戏的性能和电池耗电率。使用 Android Thermal API 监控设备的热状态,以调整游戏的工作负载,从而防止热节流。
查询设备游戏模式
游戏模式是一项功能,可让用户指定偏好设置,即是优先考虑性能还是电池续航时间,或者选择中性默认设置。如果您的游戏支持可变性能配置,请使用 Game Mode API 检查此偏好设置,并相应地修改游戏设置。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-26。"],[],[],null,["# Optimize power efficiency\n\nAndroid games are played primarily on battery-powered devices such as phones or\ntablets. Optimize your game's power efficiency to help users play your game\nlonger and give them confidence to start a game session even when their device\nisn't fully charged.\n\nUse an optimal display refresh rate\n-----------------------------------\n\nDisplay refresh rate is the speed at which the display panel of a device can\nchange to show new information. Traditionally, handheld devices used a refresh\nrate of 60Hz, updating the display contents sixty times a second. Modern devices\noften feature displays with higher refresh rates capable of updating at 90Hz or\n120Hz. Higher refresh rates result in smoother user experiences for actions such\nas scrolling, but increase the power consumption of the display panel.\n\nGames commonly have a target frame rate of 30 or 60 frames per second. If the\ndisplay refresh rate is higher than the target frame rate of the game, there is\nno benefit from the higher refresh rate, only increased power consumption. On\nhigh-refresh-rate devices, adjust the display refresh rate to match your game\ntarget frame rate as closely as possible.\n\n### Integrate or enable the Swappy frame pacing library\n\nThe Android Game Development Kit (AGDK) includes a frame pacing library known as\nSwappy. Swappy optimizes the device's display refresh rate to match your game\nframe rate as closely as possible. If you are using a custom game engine, review\nthe [Frame Pacing Library](/games/sdk/frame-pacing) guide to learn how to integrate the library into\nyour engine.\n\nSwappy is already integrated into the Unreal engine ([Frame Pacing for Mobile\nDevices](https://dev.epicgames.com/documentation/en-us/unreal-engine/frame-pacing-for-mobile-devices-in-unreal-engine)) and the Unity engine\n([PlayerSettings.Android.optimizedFramePacing](https://docs.unity3d.com/6000.0/Documentation/ScriptReference/PlayerSettings.Android-optimizedFramePacing.html))\nand optimizes the display refresh rate if enabled in your game project.\n\n### Call the Android frame rate API\n\nAs an alternative to integrating the frame pacing library, use the [Android\nframe rate API](/media/optimize/performance/frame-rate) to directly adjust the display refresh rate.\n\nUse the Vulkan API for graphics\n-------------------------------\n\nAndroid supports two graphics APIs: the older OpenGL ES API and the newer Vulkan\nAPI. Vulkan is now the primary graphics API on Android and is more efficient\nthan OpenGL ES. For more information on Vulkan's benefits and how to use it, see\n[Use Vulkan for graphics](/games/develop/vulkan/overview).\n\nRespond to device thermal conditions\n------------------------------------\n\nHigh utilization of the device's CPU and GPU generates heat. Power efficiency\ndrops as the device heats up. If a device gets too hot, it downclocks the\nspeed of the CPU and GPU to reduce power consumption and allow the device to\ncool. This behavior, referred to as thermal throttling, affects the performance\nof your game and its rate of battery drain. Use the [Android Thermal API](/games/optimize/adpf/thermal) to\nmonitor the thermal state of the device to adjust your game's workload to\nprevent thermal throttling.\n\nQuery the device Game Mode\n--------------------------\n\nGame Mode is a feature that lets the user specify a preference of whether to\ntrade off performance against battery life, battery life against performance, or\nselect a neutral default. If your game supports variable performance\nconfigurations, use the [Game Mode API](/games/optimize/adpf/gamemode/gamemode-api) to check for this preference and\nmodify your game settings accordingly.\n\nAdditional resources\n--------------------\n\n[Android Studio power profiler](/studio/profile/power-profiler)\n\n[Unity power efficiency demo sample (GitHub)](https://github.com/android/games-samples/tree/main/unity/power_efficiency_demo)"]]