โหมดแอมเบียนท์
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
โหมดแอมเบียนท์คือภาพพักหน้าจอที่ติดตั้งไว้ใน Google TV และ Android TV โดยมีวัตถุประสงค์เพื่อหลีกเลี่ยงการแสดงภาพนิ่งเป็นเวลานาน ซึ่งสำคัญสำหรับเทคโนโลยีการแสดงผล เช่น OLED ที่อาจเกิดปัญหาหน้าจอเบิร์นได้
ระบบปฏิบัติการจะใส่อุปกรณ์ไว้ในโหมดแอมเบียนท์หลังจากไม่มีการใช้งานของผู้ใช้เป็นเวลา 10 นาที หลังจากผู้ใช้ไม่ได้ใช้งานเป็นระยะเวลาหนึ่ง (กำหนดโดยการตั้งค่าโหมดประหยัดพลังงานของอุปกรณ์) ระบบปฏิบัติการจะเข้าสู่โหมดประหยัดพลังงาน โดยปิดการแสดงผล แอปการเล่นสื่ออาจป้องกันไม่ให้อุปกรณ์เข้าสู่โหมดแอมเบียนท์ แม้ว่าผู้ใช้จะไม่โต้ตอบกับอุปกรณ์ เช่น ขณะดูภาพยนตร์
หากผู้ใช้โต้ตอบกับอุปกรณ์ภายใน 30 นาทีหลังจากเข้าสู่โหมดแอมเบียนท์ ระบบจะกู้คืนแอปที่ใช้งานอยู่เมื่อเข้าสู่โหมดแอมเบียนท์
หากผู้ใช้โต้ตอบกับอุปกรณ์นานกว่า 30 นาทีหลังจากเข้าสู่โหมดแอมเบียนท์ ระบบจะนําผู้ใช้กลับไปยังหน้าจอหลัก
เมื่อผู้ใช้เปิดอุปกรณ์โดยใช้ปุ่มเปิด/ปิดขณะที่อุปกรณ์อยู่ในโหมดประหยัดพลังงาน ระบบจะนำผู้ใช้ไปยังหน้าจอหลัก หรือหากผู้ใช้เปิดอุปกรณ์ขณะที่อยู่ในโหมดประหยัดพลังงานโดยใช้ปุ่มแอปที่เฉพาะเจาะจง (เช่น YouTube) ระบบจะนำผู้ใช้ไปยังแอปนั้นโดยตรง
การเล่นวิดีโอ
สําหรับการเล่นวิดีโอ คุณต้องป้องกันไม่ให้อุปกรณ์เข้าสู่โหมดแอมเบียนท์ขณะที่เล่นวิดีโอโดยผู้ใช้เพื่อให้ผู้ใช้ได้รับประสบการณ์การรับชมที่ราบรื่น อย่างไรก็ตาม แอปไม่ควรป้องกันไม่ให้อุปกรณ์เข้าสู่โหมดแอมเบียนท์เมื่อหยุดเล่นหรือหยุดชั่วคราว
การเล่นเสียง
สําหรับการเล่นเสียง แอปไม่ควรป้องกันโหมดแอมเบียนท์ระหว่างการเล่น เว้นแต่จะใช้ภาพพักหน้าจอของตัวเองที่มีภาพเคลื่อนไหว
การเล่นเสียงจะดำเนินต่อไปขณะที่โหมดแอมเบียนท์ทำงานอยู่
การเล่นเสียงใน Android จะถือการล็อกการตื่นบางส่วนโดยปริยาย
การดำเนินการนี้จะไม่ป้องกันไม่ให้อุปกรณ์เข้าสู่โหมดแอมเบียนท์ แต่จะป้องกันไม่ให้เปลี่ยนเป็นโหมดประหยัดพลังงานในภายหลัง ดังนั้นการเล่นจะยังคงดำเนินต่อไปแม้ว่าอุปกรณ์จะเข้าสู่โหมดแอมเบียนท์ แต่อุปกรณ์จะได้รับการปกป้องไม่ให้เข้าสู่โหมดสลีปเพื่อให้เล่นได้อย่างต่อเนื่อง
การป้องกันโหมดแอมเบียนท์
คุณสามารถป้องกันไม่ให้ระบบปฏิบัติการนำอุปกรณ์เข้าสู่โหมดแอมเบียนท์ได้ แต่ต้องใช้ตามข้อกำหนดของโหมดแอมเบียนท์
นักพัฒนาแอปไม่สามารถป้องกันไม่ให้อุปกรณ์เข้าสู่โหมดประหยัดพลังงาน
แอปสามารถป้องกันไม่ให้หน้าจอปิดได้โดยการตั้งค่า Flag ใน Window
ดังนี้
Kotlin
requireActivity().window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
Java
requireActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
โหมดแอมเบียนท์จะปิดอยู่ขณะตั้งค่า Flag นี้ หากต้องการเปิดใช้อีกครั้ง คุณต้องล้างการแจ้งว่าไม่เหมาะสม ดังนี้
Kotlin
requireActivity().window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
Java
requireActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา 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,["# Ambient Mode is a screensaver built into Google TV and Android TV. Its purpose\nis to avoid displaying static images for extended periods. This is important\nfor display technologies, such as OLED, which may be susceptible to screen burn.\n\nThe OS will put the device into Ambient Mode after 10 minutes of user\ninactivity. After a further period of user inactivity (defined by the device\nEnergy Saver setting) the OS will enter Energy Saver mode,\npowering the display off. Media playback apps may prevent the device\nfrom entering Ambient Mode, despite the user not interacting with it, for\nexample, while watching a movie.\n\nIf the user interacts with the device within 30 minutes of entering Ambient\nMode, the app that was active when Ambient Mode was entered will be restored.\nIf the user interacts with the device more than 30 minutes after entering\nAmbient Mode, they will be returned to the Home screen.\nWhen the user starts the device using the power button while it's in Energy\nSaver mode, they will be taken to the Home screen. Alternatively, if the user\nstarts the device while it's in Energy Saver mode using specific app buttons\n(for example, YouTube) they will be taken directly to that app.\n| **Note:** It is important to ensure that your app meets [the Ambient Mode requirements](/docs/quality-guidelines/tv-app-quality#ambient-mode) when submitting it to Google Play.\n\nVideo playback\n--------------\n\nFor video playback, it's important to [prevent the device entering Ambient Mode\nduring user-initiated playback](/docs/quality-guidelines/tv-app-quality#TV-BU)\nto provide an uninterrupted viewing experience. However, apps should *not*\nprevent devices from entering Ambient Mode when playback is stopped or paused.\n\nAudio playback\n--------------\n\nFor audio playback, apps\n[should not prevent Ambient Mode during playback](/docs/quality-guidelines/tv-app-quality#TV-BA)\nunless they implement their own screensaver with non-static imagery.\nAudio playback will continue while Ambient Mode is active.\n\nAudio playback on Android will implicitly hold a\n[partial wake lock](/reference/android/os/PowerManager#PARTIAL_WAKE_LOCK).\nThis will *not* prevent the device from entering Ambient Mode, but *will*\nprevent the subsequent transition to Energy Saver mode. Playback will therefore\ncontinue even after the device enters Ambient Mode, but the device will be\nprevented from going to sleep to allow uninterrupted playback.\n\nPreventing Ambient Mode\n-----------------------\n\nIt is possible to prevent the OS from putting the device into Ambient Mode, but\nthis must be used in accordance with\n[Ambient Mode requirements](/docs/quality-guidelines/tv-app-quality#ambient-mode).\nApp developers cannot prevent the device from entering\nEnergy Saver mode.\n\nApps can prevent the screen from turning off by setting a flag on the\n[`Window`](/reference/android/view/Window): \n\n### Kotlin\n\n```kotlin\nrequireActivity().window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)\n```\n\n### Java\n\n```java\nrequireActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);\n```\n\nAmbient Mode will be disabled while this flag is set. To re-enable it you must\nclear the flag: \n\n### Kotlin\n\n```kotlin\nrequireActivity().window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)\n```\n\n### Java\n\n```java\nrequireActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);\n```\n| **Note:** You must only prevent the device from entering Ambient Mode for user-initiated playback sessions. If your app is [automatically playing video or animations](/docs/quality-guidelines/tv-app-quality#TV-BY), you must *not* set the [`FLAG_KEEP_SCREEN_ON`](/reference/android/view/WindowManager.LayoutParams#FLAG_KEEP_SCREEN_ON) flag."]]