關於節省電池耗電量
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
如今,使用者幾乎所有事情都仰賴行動裝置,包括傳送電子郵件、管理財務、串流播放影片,以及串流播放和玩電玩遊戲。為了發揮效用,大多數應用程式都需要遠端服務提供的資料、圖片和其他媒體。請務必瞭解,您的應用程式只是使用者裝置上的眾多應用程式之一,所有應用程式都會爭用網路資源。如果管理不當,可能會對電池效能造成重大負面影響,並耗用使用者有限的網路頻寬。
自 Android 8.0 起,作業系統推出多項更新,有助於延長電池續航力、提升使用者體驗及維護系統健康狀態。不過,開發人員也可以自行採用其他考量因素、策略和模式。應用程式向網路發出的要求會耗用大量電力,因為這些要求需要耗電量極高的行動網路和 Wi-Fi 無線電。
這份指南包含下列內容:
- 應用程式的連線模型如何與無線電狀態機器互動。
- 如何運用相關技術,盡量減少資料連線的影響。
- 如何排解連線速度緩慢的問題。
- 如何只在特定情況下執行背景工作,例如裝置充電或連上 Wi-Fi 時。
- 如何追蹤應用程式的電池用量。
最後,您將瞭解三種廣泛的更新類別:使用者啟動、應用程式啟動和伺服器啟動,以及如何運用工具和技術,盡可能提升各類別的效率。
身為開發人員社群的一份子,我們都有責任為使用者提供最佳應用程式體驗。
其他資料
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-08-27 (世界標準時間)。
[[["容易理解","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-08-27 (世界標準時間)。"],[],[],null,["Users rely on their mobile devices for virtually everything these days, from\nsending emails and managing finances, to streaming videos and streaming and\nplaying video games. In order to be useful, most apps require data, images, and\nother media from remote services. It's important to remember that your app is\njust one of many apps on the user's device, all competing for network resources.\nManaged poorly, this can have a dramatic and detrimental impact on battery\nperformance and unnecessarily use the user's limited network bandwidth.\n\nStarting with [Android 8.0](/about/versions/oreo/android-8.0-changes), several\nupdates were introduced to the OS which help preserve battery, user experience,\nand system health. However, there are additional considerations, strategies, and\npatterns that you as a developer can employ yourself, as well. Requests that\nyour app makes to the network can be a major cause of battery drain because\nthey rely on the heavily power-consuming cellular and Wi-Fi radios.\n\nIn this guide, you'll learn about the following:\n\n- How your app's connectivity model interacts with the wireless radio state machine.\n- How to employ techniques for minimizing the impact of your data connection.\n- How to troubleshoot slow connections.\n- How to run background work only under specific conditions such as when the device is charging or on Wi-Fi.\n- How to track your app's battery usage over time.\n\nFinally, you'll learn about three broad categories of updates:\n[User-initiated](/develop/connectivity/minimize-effect-regular-updates#user-initiated),\n[App-initiated](/develop/connectivity/minimize-effect-regular-updates#app-initiated),\nand\n[Server-initiated](/develop/connectivity/minimize-effect-regular-updates#server-initiated),\nwith tools and techniques for maximizing the efficiency of each category.\n\nUltimately, it's all of our responsibilities as a developer community to provide\nthe best app experience for our users.\n\nAdditional material"]]