ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
การจัดการพลังงาน
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
อายุการใช้งานแบตเตอรี่เป็นข้อกังวลของผู้ใช้มาอย่างยาวนาน Android เพิ่มฟีเจอร์ใหม่ๆ อย่างต่อเนื่องเพื่อช่วยแพลตฟอร์มเพิ่มประสิทธิภาพการทำงานของแอปและอุปกรณ์เมื่อไม่ได้เสียบชาร์จ เพื่อยืดอายุการใช้งานแบตเตอรี่
Android มีการปรับปรุงอายุการใช้งานแบตเตอรี่ดังต่อไปนี้
-
ข้อจํากัดของแอป
แพลตฟอร์มจะแนะนำแอปที่ส่งผลเสียต่ออายุการใช้งานแบตเตอรี่ เพื่อให้ผู้ใช้เลือกจำกัดไม่ให้แอปเหล่านั้นใช้ทรัพยากรได้ แอปจะไม่ถูกจำกัดการทำงานในเบื้องหลังโดยค่าเริ่มต้น
- โหมดสแตนด์บายแอป แพลตฟอร์มสามารถวางแอปที่ไม่ได้ใช้งานไว้ในโหมดสแตนด์บายของแอป ซึ่งจะจำกัดการเข้าถึงเครือข่ายชั่วคราวและเลื่อนการซิงค์และงานสำหรับแอปเหล่านั้น
-
Doze แพลตฟอร์มอาจเข้าสู่สถานะสลีปลึก (กลับมาทำงานตามปกติเป็นระยะๆ) หากผู้ใช้ไม่ได้ใช้งานอุปกรณ์ (หน้าจอปิดอยู่และไม่มีการเคลื่อนไหว) เป็นระยะเวลานาน Android 7.0 ขึ้นไปยังช่วยให้ Doze ทริกเกอร์ชุดการเพิ่มประสิทธิภาพที่เบาลงเมื่อผู้ใช้ปิดหน้าจออุปกรณ์แต่ยังคงเคลื่อนไหวไปรอบๆ
- จำกัดการโอนพลังงานระหว่างการสำรองและกู้คืนข้อมูลด้วย USB เมื่อทำการสำรองหรือกู้คืนข้อมูลผ่าน USB ให้ตั้งค่า
enableLimitPowerTransfer
ของคลาส UsbPort
เป็น true
เพื่อปิดใช้การชาร์จและจำกัดกำลังไฟฟ้า หากต้องการยืนยันว่ามีการจำกัดกำลัง ให้เรียกใช้เมธอด isPowerTransferLimited
ของคลาส UsbPortStatus
เมื่อ isPowerTransferLimited
เป็น true
อุปกรณ์ Android จะลดการใช้พลังงานในฐานะตัวรับเป็น 0 (หรือค่าต่ำสุดที่ฮาร์ดแวร์อนุญาต) และจำกัดกระแสไฟฟ้าของแหล่งที่มาเป็น 0 การจำกัดกำลังไฟฟ้าของแหล่งจ่ายไฟจะบังคับใช้ได้ก็ต่อเมื่อพาร์ทเนอร์พอร์ตทั้ง 2 รายรองรับข้อกำหนดการจ่ายพลังงานผ่าน USB (PD) เท่านั้น หากต้องการเปลี่ยนการใช้พลังงานกลับเป็นสถานะเริ่มต้น ให้ตั้งค่า enableLimitPowerTransfer
เป็น false
ระบบจะเปลี่ยนกลับไปเป็นสถานะเริ่มต้นเมื่อถอดสาย USB ด้วย
-
ข้อยกเว้น โดยปกติแล้ว แอประบบที่โหลดไว้ล่วงหน้าและบริการรับส่งข้อความบนระบบคลาวด์จะได้รับการยกเว้นจากโหมดสแตนด์บายของแอปและโหมดประหยัดพลังงานโดยค่าเริ่มต้น นักพัฒนาแอปสามารถใช้ Intent เพื่อใช้การตั้งค่าเหล่านี้กับแอปของตนได้ ผู้ใช้ยกเว้นแอปจากโหมดสแตนด์บายของแอปและโหมดประหยัดพลังงาน Doze ได้ในส่วนเมนูการตั้งค่า
-
อุปกรณ์ติดตาม เครื่องมือติดตามลักษณะการทำงานในเบื้องหลังของแอปจะตรวจสอบการใช้แบตเตอรี่ในเบื้องหน้าและเบื้องหลังของแอปเพื่อพิจารณาว่าแอปละเมิดนโยบายหรือไม่
แอปที่ได้รับการยกเว้น
คุณสามารถยกเว้นแอปไม่ให้อยู่ภายใต้โหมด Doze หรือโหมดสแตนด์บายแอปได้
คุณอาจต้องใช้ข้อยกเว้นใน Use Case ต่อไปนี้
- ผู้ผลิตอุปกรณ์ที่ใช้แพลตฟอร์มการรับส่งข้อความบนระบบคลาวด์อื่นที่ไม่ใช่ Firebase Cloud Messaging (FCM)
- ผู้ให้บริการที่ใช้แพลตฟอร์มการรับส่งข้อความบนระบบคลาวด์ที่ไม่ใช่ FCM
- แอปของบุคคลที่สามที่ใช้แพลตฟอร์มการรับส่งข้อความบนระบบคลาวด์ที่ไม่ใช่ FCM
คำเตือน: อย่ายกเว้นแอปเพื่อหลีกเลี่ยงการทดสอบและการเพิ่มประสิทธิภาพ การยกเว้นที่ไม่จำเป็นจะลดประโยชน์ของโหมดสลีปและโหมดแอปรอ และอาจส่งผลเสียต่อประสบการณ์ของผู้ใช้ เราจึงขอแนะนำอย่างยิ่งให้ลดการยกเว้นดังกล่าว เนื่องจากเป็นการอนุญาตให้แอปหลีกเลี่ยงการควบคุมที่เป็นประโยชน์ของแพลตฟอร์มในการใช้พลังงาน หากผู้ใช้ไม่พอใจกับการสิ้นเปลืองพลังงานของแอปเหล่านี้ ก็อาจทำให้เกิดความไม่พอใจ ประสบการณ์ที่ไม่ดี (และรีวิวเชิงลบสำหรับแอป) รวมถึงคำถามเกี่ยวกับการสนับสนุนลูกค้า ด้วยเหตุนี้ เราขอแนะนำอย่างยิ่งว่าอย่ายกเว้นแอปของบุคคลที่สาม และยกเว้นเฉพาะบริการรับส่งข้อความบนระบบคลาวด์หรือแอปที่มีฟังก์ชันการทำงานคล้ายกัน
แอปที่ได้รับการยกเว้นโดยค่าเริ่มต้นจะแสดงอยู่ในการตั้งค่า > แอปและการแจ้งเตือน > การเข้าถึงแอปพิเศษ > การเพิ่มประสิทธิภาพแบตเตอรี่ รายการนี้ใช้ยกเว้นแอปจากทั้งโหมด Doze และสแตนด์บายแอป เมนูการตั้งค่าต้องแสดงแอปที่ได้รับการยกเว้นทั้งหมดเพื่อให้ผู้ใช้มีความโปร่งใส
ผู้ใช้ยกเว้นแอปด้วยตนเองได้โดยใช้การตั้งค่า > แอปและการแจ้งเตือน >
APP-NAME > แบตเตอรี่ > การเพิ่มประสิทธิภาพแบตเตอรี่ จากนั้นเลือกแอปเพื่อปิด (หรือเปิด) การเพิ่มประสิทธิภาพ อย่างไรก็ตาม ผู้ใช้จะเปลี่ยนสถานะ "ยกเว้น" ของแอปหรือบริการที่ได้รับการยกเว้นโดยค่าเริ่มต้นในอิมเมจระบบไม่ได้
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[[["เข้าใจง่าย","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-27 UTC"],[],[],null,["# Power management\n\nBattery life is a perennial user concern. To extend battery life, Android\ncontinually adds new features to help the platform optimize the off-charger\nbehavior of apps and devices.\n\nAndroid includes the following battery life enhancements:\n\n- [App restrictions](/docs/core/power/app_mgmt#app-restrictions). The platform can suggest apps that negatively affect battery life, so that users can choose to restrict those apps from consuming resources. Apps aren't background restricted by default.\n- [App standby](/docs/core/power/app_mgmt#app-standby). The platform can place unused apps in App standby mode, temporarily restricting network access and deferring syncs and jobs for those apps.\n- [Doze](/docs/core/power/platform_mgmt#doze). The platform can enter a state of deep sleep (periodically resuming normal operations) if users haven't actively used their device (screen off and stationary) for extended periods of time. Android 7.0 and higher also enables Doze to trigger a lighter set of optimizations when users turn off the device screen yet continue to move around.\n- Limiting power transfer during USB backup and restore. When performing a USB backup or restore, set the `UsbPort` class's `enableLimitPowerTransfer` method to `true` to disable charging and limit the sourcing power. To verify that power is limited, call `UsbPortStatus` class's `isPowerTransferLimited` method. When `isPowerTransferLimited` is `true`, the Android device reduces the power draw as a sink to 0 (or the lowest possible value allowed by hardware) and limits the source current to 0. Limiting source power can be enforced only when both port partners support USB power delivery (PD) specification. To return power usage to the defatult state, set `enableLimitPowerTransfer` to `false`. The default state is also returned when the USB cable is disconnected.\n- [Exemptions](#exempt-apps). Preloaded system apps and cloud messaging services are typically exempted from App standby and Doze by default. App developers can use intents to apply these settings to their apps. Users can exempt apps from App standby and Doze power-saving modes in the Settings menu.\n- [Trackers](/docs/core/power/trackers). App background behavior trackers monitor apps' foreground and background battery usage to determine if the apps violate some policy.\n\nExempt apps\n-----------\n\nYou can exempt apps from being subject to Doze or App standby.\nExemptions may be needed in the following use cases:\n\n- Device manufacturers using a cloud messaging platform other than [Firebase\n cloud messaging (FCM)](https://firebase.google.com/docs/cloud-messaging/)\n- Carrier using non-FCM cloud messaging platform\n- Third-party app using non-FCM cloud messaging platform\n\n**Warning:** Don't exempt apps to avoid testing\nand optimizing. Unnecessary exemptions undermine the benefits of Doze and App\nstandby and can compromise the user experience, so we strongly suggest\nminimizing such exemptions as they allow apps to defeat beneficial\ncontrols the platform has over power use. If users become unhappy about the\npower consumption of these apps, it can lead to frustration, bad experiences\n(and negative reviews for the app), and customer support questions. For these\nreasons, we strongly recommend that you don't exempt third-party apps\nand instead exempt only cloud messaging services or apps with similar\nfunctions.\n\nApps exempted by default are listed in **Settings \\\u003e App \\&\nNotifications \\\u003e Special app access \\\u003e Battery Optimization** . This list is\nused for exempting the app from both Doze and App standby modes. To provide\ntransparency to the user, the Settings menu **MUST** show all\nexempted apps.\n\nUsers can manually exempt apps using **Settings \\\u003e App \\& Notifications \\\u003e\n\u003cvar translate=\"no\"\u003eAPP-NAME\u003c/var\u003e \\\u003e Battery \\\u003e Battery Optimization** and then selecting the\napp to turn off (or back on) optimization. However, users can't change the except status of any\napp or service that is exempted by default in the system image."]]