Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Khi cần thiết, bạn có thể sử dụng khoá chế độ thức để ngăn thiết bị chuyển sang chế độ ngủ.
Trong một số trường hợp, bạn có thể cần giữ thiết bị ở trạng thái bật ngay cả khi ứng dụng của bạn chạy ở chế độ nền. Để thực hiện việc này, bạn có thể tạo một khoá đánh thức.
Ý kiến phản hồi của bạn có vai trò quan trọng trong việc cải thiện tài liệu của chúng tôi. Vui lòng gửi ý kiến phản hồi cho chúng tôi qua đường liên kết sau:
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-08-27 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-27 UTC."],[],[],null,["When it's necessary, you can use wake locks to keep the device from going to\nsleep.\n\nUnder some circumstances, you may need to keep the device awake even when your\napp is in the background. To do this, you can create a *wake lock*.\n\nYour feedback is a crucial part of improving our documentation. Please give us\nyour feedback using the following link:\n\n\n[Give feedback](https://docs.google.com/forms/d/e/1FAIpQLSc0OMFG-G88ZyHh_xwauaM2gimwP9-MFvRd6C49q0atZNpZ9w/viewform?usp=dialog)\n| **Note:** Creating and holding wake locks can have a dramatic impact on the device's battery life. You shouldn't use wake locks if there are any suitable alternatives. For other options, see the [Choose the right API to keep the device awake](/develop/background-work/background-tasks/awake) documentation. If you do need to use a wake lock, make sure to hold it for as short a time as possible.\n\nThis guide explains the following areas:\n\n- [Set a wake lock](/develop/background-work/background-tasks/awake/wakelock/set)\n- [Release a wake lock](/develop/background-work/background-tasks/awake/wakelock/release)\n- [Follow wake lock best practices](/develop/background-work/background-tasks/awake/wakelock/best-practices)\n- [Debug wake locks locally](/develop/background-work/background-tasks/awake/wakelock/debug-locally)\n- [Identify wake locks created by other APIs](/develop/background-work/background-tasks/awake/wakelock/identify-wls)\n\nThis guide assumes you're familiar with the following topics:\n\n- [Choose the right API to keep the device awake](/develop/background-work/background-tasks/awake)\n- [Request runtime permissions](/training/permissions/requesting)"]]