부분적인 장기간 wake lock
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
부분적인 wake lock은 시스템 시간 초과가 발생하거나 사용자가 전원 버튼을 눌러 기기의 화면이 꺼진 후에 개발자가 CPU를 계속 실행할 수 있게 하는
PowerManager
API의 메커니즘입니다. 앱이 acquire()
를 PARTIAL_WAKE_LOCK
플래그와 함께 호출하거나 wake lock을 획득하는 다른 API를 사용하여 부분적인 wake lock을 획득합니다.
앱이 백그라운드에서 실행되는 동안 (앱의 일부가 사용자에게 표시되지 않음) 부분적인 wake lock이 오랫동안 유지되면 장기간 wake lock이 됩니다. 이 상태는 기기가 저전력 상태로 전환되지 않도록 하기 때문에 기기의 배터리를 소모합니다. 부분적인 wake lock은 필요할 때만 사용하고 더 이상 필요하지 않을 때 즉시 해제해야 합니다.
앱에 부분적인 장기간 wake lock이 있는 경우 이 페이지의 안내에 따라 문제를 진단하고 해결할 수 있습니다.
문제 감지
앱의 부분적인 wake lock이 장기간 wake lock이 되는 것을 항상 알 수 있는 것은 아닙니다.
앱을 이미 게시했다면 Android vitals를 사용하여 문제를 인식할 수 있습니다.
Android vitals
Android vitals를 사용하면 앱이 부분적인 장기간 wake lock을 나타낼 때 Play Console을 통해 알림을 보냄으로써 앱의 성능을 개선할 수 있습니다. Android vitals는 백그라운드에서 24시간 동안 1시간 길이의 부분적인 wake lock이 1회 이상 발생하는 경우 부분적인 wake lock을 장기간 wake lock으로 보고합니다.
표시된 배터리 세션 수는 측정된 모든 앱 사용자의 집계입니다. Google Play에서 Android vitals 데이터를 수집하는 방법에 관한 자세한 내용은 Play Console 문서를 참고하세요.
앱에 부분적인 장기간 wake lock이 있다는 것을 알았다면 다음 단계는 문제를 해결하는 것입니다.
문제 해결
wake lock은 기기 배터리를 소모할 수 있으므로 대안이 있는 경우 wake lock을 사용해서는 안 됩니다. 기기를 깨어 있게 하는 적절한 API 선택 문서를 참고하면 앱에 가장 적합한 솔루션을 찾을 수 있습니다.
wake lock을 사용해야 하는 경우 wake lock 권장사항을 준수하여 wake lock이 기기 효율성을 저해하지 않도록 하세요. 특히 획득한 모든 기기가 해제되었는지 확인하고 최대한 빨리 잠금을 해제하세요.
코드의 문제를 해결한 후 로컬 wake lock 디버깅 도구를 사용하여 수정사항을 확인할 수 있습니다.
참고 항목
추천 서비스
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 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,["# Stuck partial wake locks\n\nPartial wake locks are a mechanism in the\n[`PowerManager`](/reference/android/os/PowerManager) API\nthat lets developers keep the CPU running after a device's display turns off\n(whether due to system timeout or the user pressing the power button). Your\napp acquires a partial wake lock by calling\n[`acquire()`](/reference/android/os/PowerManager.WakeLock#acquire())\nwith the\n[`PARTIAL_WAKE_LOCK`](/reference/android/os/PowerManager#PARTIAL_WAKE_LOCK)\nflag, or by using [other APIs that acquire wake locks](/develop/background-work/background-tasks/awake/wakelock/identify-wls).\nA partial wake lock becomes *stuck* if it is held for a long time while\nyour app is running in the\nbackground (no part of your app is visible to the user). This condition drains\nthe device's battery because it prevents the device from entering lower power\nstates. Partial wake locks should be used only when necessary and released as\nsoon as no longer needed.\n\nIf your app has a stuck partial wake lock, you can use the guidance in this page\nto diagnose and fix the problem.\n\nDetect the problem\n------------------\n\nYou may not always know that your app's partial wake locks are stuck.\nIf you have already published your app,\nAndroid vitals can help make you aware of the problem.\n\n### Android vitals\n\nAndroid vitals can help improve your app's performance by alerting you via the\n[Play Console](https://play.google.com/console/) when your app is\nexhibiting stuck partial wake locks. Android vitals reports partial wake locks\nas stuck when at least one, hour-long, while in the background, partial wake\nlock occurs in a 24-hour period.\n\nThe number of battery sessions displayed is an aggregate for all measured users\nof the app. For information on how Google Play collects Android vitals data, see\nthe\n[Play Console](https://support.google.com/googleplay/android-developer/answer/7385505)\ndocumentation.\n\nOnce you're aware that your app has stuck partial wake locks,\nyour next step is to address the issue.\n\nFix the problem\n---------------\n\nBecause wake locks can drain the device battery, you shouldn't use wake\nlocks if there's an alternative. The\n[Choose the right API to keep the device awake](/develop/background-work/background-tasks/awake)\ndocumentation can help you find the best solution for your app.\n\nIf you do need to use a wake lock, [follow wake lock best practices](/develop/background-work/background-tasks/awake/wakelock/best-practices)\nto make sure your wake locks don't hurt device efficiency. In particular,\nmake sure every device you acquire is released, and release the lock as quickly\nas possible.\n\nAfter fixing the problem in code, you can verify your fixes by using [local\nwake lock debugging tools](/develop/background-work/background-tasks/awake/wakelock/debug-locally).\n\nSee also\n--------\n\n- [Excessive partial wake locks (beta)](/topic/performance/vitals/excessive-wakelock)\n- [Wake lock documentation](/develop/background-work/background-tasks/awake/wakelock)\n\nRecommended for you\n-------------------\n\n- Note: link text is displayed when JavaScript is off\n- [Frozen frames](/topic/performance/vitals/render#frozen-frames)\n- [Run benchmarks in Continuous Integration](/topic/performance/benchmarking/benchmarking-in-ci)\n- [Create and measure Baseline Profiles without Macrobenchmark](/topic/performance/baselineprofiles/manually-create-measure)"]]