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"]],["上次更新時間: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)"]]