{"id":348712,"date":"2025-10-02T16:53:38","date_gmt":"2025-10-02T21:53:38","guid":{"rendered":"https:\/\/michigandigitalnews.com\/index.php\/2025\/10\/02\/optimize-your-app-battery-using-android-vitals-wake-lock-metric\/"},"modified":"2025-10-02T16:53:38","modified_gmt":"2025-10-02T21:53:38","slug":"optimize-your-app-battery-using-android-vitals-wake-lock-metric","status":"publish","type":"post","link":"https:\/\/michigandigitalnews.com\/index.php\/2025\/10\/02\/optimize-your-app-battery-using-android-vitals-wake-lock-metric\/","title":{"rendered":"Optimize your app battery using Android vitals wake lock metric"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div><span><span><\/p>\n<p><iframe title=\"Optimize your app battery drain using Android Vitals wake lock metric\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/-6mEvkLOlno?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p><\/span><\/span><\/p>\n<div class=\"separator\" style=\"clear: both;\">\n<p><i>Most of the content of this post is also available in video format, go give it a watch!<\/i><\/p>\n<p>Battery life is a crucial aspect of user experience and wake locks play a major role. Are you using them excessively? In this blog post we\u2019ll explore what wake locks are, what are some best practices for using them and how you can better understand your own app\u2019s behavior with the Play Console metric.<\/p><\/div>\n<h2 style=\"text-align: left;\">Excessive partial wake lock usage in Android Vitals<\/h2>\n<p><span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;\"><span style=\"font-family: inherit;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">The Play Console now monitors battery drain, with a focus on <\/span><a href=\"https:\/\/play.google.com\/console\/developers\/app\/vitals\/metrics\/details?metric=EXCESSIVE_BACKGROUND_WAKELOCKS&amp;days=28\" style=\"text-decoration-line: none;\"><span face=\"Arial, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">excessive partial wake lock usage<\/span><\/a><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">, as a key performance indicator.<\/span><\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">This feature elevates the importance of battery efficiency alongside existing core metric stability indicators: excessive user-perceived crashes and ANRs. <\/span><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; vertical-align: baseline; white-space-collapse: preserve;\">Currently, an app exceeding the threshold will not be less discoverable on Google Play.<\/span><\/span><\/p>\n<div class=\"separator\" style=\"clear: both; text-align: center;\"><a href=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEgCqbeMHN5AZv4R7ZmV5d1H9T7SSVS22ZnLhEvy8sSXc9V9w2divLZD_4sNLP9-HIch0UCQL9uNYytc_16ryVkmSwbX3cm88JJ1lKpR64WQbWAYhtsGmCWi5AVxQ-AG2cFy53QPOhpzECD3uoRDRVeVBr_1lXuAVT-e0guAsYD6l6mW9oGw76KQZgT_a0g\/s1134\/asset1-android-vitals.png\" style=\"margin-left: 1em; margin-right: 1em;\"><img fetchpriority=\"high\" decoding=\"async\" border=\"0\" data-original-height=\"1101\" data-original-width=\"1134\" height=\"621\" src=\"https:\/\/blogger.googleusercontent.com\/img\/b\/R29vZ2xl\/AVvXsEgCqbeMHN5AZv4R7ZmV5d1H9T7SSVS22ZnLhEvy8sSXc9V9w2divLZD_4sNLP9-HIch0UCQL9uNYytc_16ryVkmSwbX3cm88JJ1lKpR64WQbWAYhtsGmCWi5AVxQ-AG2cFy53QPOhpzECD3uoRDRVeVBr_1lXuAVT-e0guAsYD6l6mW9oGw76KQZgT_a0g\/w640-h621\/asset1-android-vitals.png\" width=\"640\"\/><\/a><\/div>\n<p><\/span><\/p>\n<p>For mobile devices, the Android vitals metric applies to non-exempted wake locks acquired while the screen is off and the app is in the background or running a foreground service. Android vitals considers partial wake lock usage excessive if:<\/p>\n<p><span><\/p>\n<ul style=\"margin-bottom: 0px; margin-top: 0px; padding-inline-start: 48px;\">\n<li aria-level=\"1\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: disc; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 12pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">Wake locks are held for at least two hours within a 24-hour period.<\/span><\/p>\n<\/li>\n<li aria-level=\"1\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: disc; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 0pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">It affects more than 5% of your app&#8217;s sessions, averaged over 28 days.<\/span><\/p>\n<\/li>\n<\/ul>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Wake locks created by <\/span><a href=\"https:\/\/developer.android.com\/develop\/background-work\/background-tasks\/awake\/wakelock\/identify-wls#media\" style=\"text-decoration-line: none;\"><span face=\"Arial, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">audio<\/span><\/a><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">, <\/span><a href=\"https:\/\/developer.android.com\/develop\/background-work\/background-tasks\/awake\/wakelock\/identify-wls#location\" style=\"text-decoration-line: none;\"><span face=\"Arial, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">location<\/span><\/a><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">, and <\/span><a href=\"https:\/\/developer.android.com\/develop\/background-work\/background-tasks\/awake\/wakelock\/identify-wls#jobs\" style=\"text-decoration-line: none;\"><span face=\"Arial, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">JobScheduler<\/span><\/a><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> user initiated APIs are exempted from the wake lock calculation.<\/span><\/span><\/p>\n<p><\/span><\/p>\n<h2 style=\"text-align: left;\">Understanding wake locks<\/h2>\n<p><span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">A wake lock is a mechanism that allows an app to keep a device&#8217;s CPU running even when the user isn&#8217;t actively interacting with it.\u00a0<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">A partial wake lock keeps the CPU running even if the screen is off, preventing the CPU from entering a low-power &#8220;suspend&#8221; state. A full wake lock keeps both the screen and the CPU running.<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">There are 2 methods partial wake locks are acquired:<\/span><\/p>\n<ul style=\"margin-bottom: 0px; margin-top: 0px; padding-inline-start: 48px;\">\n<li aria-level=\"1\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: disc; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 12pt;\"><span style=\"font-family: inherit;\"><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">The app manually acquires and releases the wake lock using <\/span><a href=\"https:\/\/developer.android.com\/reference\/android\/os\/PowerManager\" style=\"text-decoration-line: none;\"><span style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; text-wrap-mode: wrap; vertical-align: baseline;\">PowerManager<\/span><\/a><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\"> APIs for a specific use case, often this is acquired in conjunction with a <\/span><a href=\"https:\/\/developer.android.com\/develop\/background-work\/services\/fgs\" style=\"text-decoration-line: none;\"><span style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; text-wrap-mode: wrap; vertical-align: baseline;\">Foreground Service<\/span><\/a><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\"> &#8211; a platform lifecycle API intended for user-perceptible operation.<\/span><\/span><\/p>\n<\/li>\n<li aria-level=\"1\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: disc; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 0pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">Alternatively, the wake lock is acquired by another API, and attributed to the app due to usage of the API, more on this in the best practices section.<\/span><\/p>\n<\/li>\n<\/ul>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">While wake locks are necessary for tasks like completing a user-initiated download of a large file, their <\/span><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; vertical-align: baseline; white-space-collapse: preserve;\">excessive or improper use can lead to significant battery drain<\/span><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">. We&#8217;ve seen cases where apps hold wake locks for hours or fail to release them properly, leading to user complaints about significant battery drain even when they&#8217;re not interacting with the app.<\/span><\/span><\/p>\n<p><\/span><\/p>\n<h2 style=\"text-align: left;\">Best Practices for Wake Lock Usage<\/h2>\n<p><span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Before we go over how to debug excessive wake lock usage, ensure you\u2019re following wake lock best practices.\u00a0<\/span><\/p>\n<p><\/span>Consider these four critical questions.<\/div>\n<div><b>1. Have you considered alternative wake lock options?<\/b><br \/><span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Before considering acquiring a manual partial wake lock, follow this decision-making flowchart:<\/span><\/p>\n<p><\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt; text-align: left;\"><img decoding=\"async\" src=\"https:\/\/blogger.googleusercontent.com\/img\/a\/AVvXsEj7IKuxWy034W7kFNcgIgPV7WylVsLTjLks79fIF3kKvGf6E6mg-Je640xmKMxPvMcXha-NPA-Tp9rIX5rUP4-SQws3HfcqQYi90RsLYvji9nNQSCsOQXOYyl4_YT3SG1yNYt1WxHj4MU8Rwjr6eV4mgVs8-ArJIEDBZK9NKfEUB3ouwWJU7zTVi37Dhds=s16000\"\/><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt; text-align: left;\"><i>Flowchart to decide when to manually acquire a wake lock<\/i><\/p>\n<p><span><\/p>\n<ol style=\"margin-bottom: 0px; margin-top: 0px; padding-inline-start: 48px;\">\n<li aria-level=\"1\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: decimal; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 12pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">Does the screen need to stay on?<\/span><\/p>\n<\/li>\n<\/ol>\n<li aria-level=\"1\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: decimal; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">Is the application running a foreground service?\u00a0<\/span><\/p>\n<\/li>\n<li aria-level=\"1\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: decimal; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">Is it detrimental to the user experience if the device suspends?\u00a0<\/span><\/p>\n<\/li>\n<ul style=\"margin-bottom: 0px; margin-top: 0px; padding-inline-start: 48px;\">\n<li aria-level=\"2\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: circle; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">No: For instance, updating a notification after the device wakes up doesn&#8217;t require a wake lock.\u00a0<\/span><\/p>\n<\/li>\n<li aria-level=\"2\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: circle; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">Yes: If it\u2019s critical to prevent the device from suspending, like ongoing communication with an external device, proceed.<\/span><\/p>\n<\/li>\n<\/ul>\n<li aria-level=\"1\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: decimal; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">Is there already an API keeping the device awake on your behalf?<\/span><\/p>\n<\/li>\n<ul style=\"margin-bottom: 0px; margin-top: 0px; padding-inline-start: 48px;\">\n<li aria-level=\"2\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: circle; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;\"><span style=\"font-family: inherit;\"><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">You can leverage the documentation <\/span><a href=\"https:\/\/developer.android.com\/develop\/background-work\/background-tasks\/awake\/wakelock\/identify-wls\" style=\"text-decoration-line: none;\"><span style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; text-wrap-mode: wrap; vertical-align: baseline;\">Identify wake locks created by other APIs<\/span><\/a><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\"> to identify scenarios where wake locks created by other APIs to identify scenarios where wake locks are created by other APIs such as LocationManager.<\/span><\/span><\/p>\n<\/li>\n<li aria-level=\"2\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: circle; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">If no APIs exist, proceed to the final question.<\/span><\/p>\n<\/li>\n<\/ul>\n<li aria-level=\"1\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: decimal; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 0pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">If you&#8217;ve answered all these questions and determined no alternative exists, you should proceed with manually acquiring a wake lock.<\/span><\/p>\n<\/li>\n<p><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"><b>2. Are you naming the wake lock correctly?<\/b><\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">When manually acquiring wake locks, proper naming is important for debugging:<\/span><\/p>\n<ul style=\"margin-bottom: 0px; margin-top: 0px; padding-inline-start: 48px;\">\n<li aria-level=\"1\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: disc; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 12pt;\"><span style=\"font-family: inherit;\"><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">Leave out any Personally Identifiable Information (PII)<\/span><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\"> in the name like email addresses. If PII is detected, the wake lock is logged as <\/span><span style=\"color: #188038; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">_UNKNOWN<\/span><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">, hindering debugging.<\/span><\/span><\/p>\n<\/li>\n<li aria-level=\"1\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: disc; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;\"><span style=\"font-family: inherit;\"><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">Don&#8217;t name your wake lock programmatically<\/span><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\"> using class or method names, as these can be obfuscated by tools like Proguard. Instead, use a hard-coded string.<\/span><\/span><\/p>\n<\/li>\n<li aria-level=\"1\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: disc; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 0pt;\"><span style=\"font-family: inherit;\"><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">Do not add counters or unique identifiers to wake lock tags<\/span><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">. The same tag should be used every time the wake lock runs to allow the system to aggregate usage by name, making abnormal behavior easier to detect.<\/span><\/span><\/p>\n<\/li>\n<\/ul>\n<p><\/span><b>3. Is the acquired wake lock always released?<\/b><span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">If you&#8217;re acquiring a wake lock manually, ensure the wake lock release always executes. Failing to release a wake lock can cause significant battery drain.\u00a0<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">For example, if an uncaught exception is thrown during <\/span><span style=\"color: #188038; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">processingWork()<\/span><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">, the <\/span><span style=\"color: #188038; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">release()<\/span><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> call might never happen. Instead, you can use a <\/span><span style=\"color: #188038; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">try-finally<\/span><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> block to guarantee the wake lock is released, even if an exception occurs.<\/span><\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Additionally, you can add a timeout to the wake lock to ensure it releases after a specific period, preventing it from being held indefinitely.<\/span><\/p>\n<p><\/span><\/p>\n<p><!--HTML generated using hilite.me--><\/p>\n<pre style=\"line-height: 125%; margin: 0px;\"><span\/><span style=\"color: #008800; font-weight: bold;\">fun<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #0066bb; font-weight: bold;\">processingWork<\/span>()<span style=\"color: #bbbbbb;\"> <\/span>{\n<span style=\"color: #bbbbbb;\">    <\/span>wakeLock.<span style=\"color: #0000cc;\">apply<\/span><span style=\"color: #bbbbbb;\"> <\/span>{\n<span style=\"color: #bbbbbb;\">        <\/span><span style=\"color: #008800; font-weight: bold;\">try<\/span><span style=\"color: #bbbbbb;\"> <\/span>{\n<span style=\"color: #bbbbbb;\">            <\/span>acquire(<span style=\"color: #6600ee; font-weight: bold;\">60<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">*<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #6600ee; font-weight: bold;\">10<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">*<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #6600ee; font-weight: bold;\">1000<\/span>)<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #888888;\">\/\/ timeout after 10 minutes<\/span>\n<span style=\"color: #bbbbbb;\">            <\/span>doTheWork()\n<span style=\"color: #bbbbbb;\">        <\/span>}<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #008800; font-weight: bold;\">finally<\/span><span style=\"color: #bbbbbb;\"> <\/span>{\n<span style=\"color: #bbbbbb;\">            <\/span>release()\n<span style=\"color: #bbbbbb;\">        <\/span>}\n<span style=\"color: #bbbbbb;\">    <\/span>}\n}<\/pre>\n<p><b>4. Can you reduce the wake-up frequency?<\/b><span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">For periodic data requests, reducing how often your app wakes up the device is key to battery optimization. Some examples of reducing wake-up frequency include:<\/span><\/p>\n<ul style=\"margin-bottom: 0px; margin-top: 0px; padding-inline-start: 48px;\">\n<li aria-level=\"1\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: disc; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 12pt;\"><span style=\"font-family: inherit;\"><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; text-wrap-mode: wrap; vertical-align: baseline;\">WorkManager:<\/span><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\"> Increase the periodic interval in <\/span><a href=\"https:\/\/developer.android.com\/reference\/androidx\/work\/PeriodicWorkRequest\" style=\"text-decoration-line: none;\"><span style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; text-wrap-mode: wrap; vertical-align: baseline;\">PeriodicWorkRequest<\/span><\/a><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">s.<\/span><\/span><\/p>\n<\/li>\n<li aria-level=\"1\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: disc; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;\"><span style=\"font-family: inherit;\"><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; text-wrap-mode: wrap; vertical-align: baseline;\">SensorManager:<\/span><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\"> Leverage batching by specifying <\/span><a href=\"https:\/\/developer.android.com\/reference\/android\/hardware\/SensorManager#registerListener(android.hardware.SensorEventListener,%20android.hardware.Sensor,%20int,%20int)\" style=\"text-decoration-line: none;\"><span style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; text-wrap-mode: wrap; vertical-align: baseline;\">maxReportLatencyMs<\/span><\/a><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\"> when registering the listener.<\/span><\/span><\/p>\n<\/li>\n<li aria-level=\"1\" dir=\"ltr\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; list-style-type: disc; vertical-align: baseline; white-space: pre;\">\n<p dir=\"ltr\" role=\"presentation\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;\"><span style=\"font-family: inherit;\"><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; text-wrap-mode: wrap; vertical-align: baseline;\">Fused Location Provider:<\/span><span style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-wrap-mode: wrap; vertical-align: baseline;\">\u00a0<\/span><\/span><\/p>\n<\/li>\n<\/ul>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">You can view more details in the <\/span><a href=\"https:\/\/developer.android.com\/develop\/background-work\/background-tasks\/awake\/wakelock\/best-practices\" style=\"text-decoration-line: none;\"><span face=\"Arial, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">wake lock best practices documentation<\/span><\/a><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">.<\/span><\/span><\/p>\n<p><\/span><\/p>\n<h2 dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 6pt; margin-top: 14pt;\">Debugging excessive wake lock usage<\/h2>\n<p>Even with the best intentions, excessive wake lock usage can occur. If your app is flagged in the Play Console, here&#8217;s how to debug it:<\/p>\n<\/div>\n<div><b><br \/><\/b><span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">You can identify worker-held wake locks with this wake lock name:<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"color: #188038; font-family: &quot;Roboto Mono&quot;, monospace; font-size: 11pt; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">*job*\/<package_name>\/androidx.work.impl.background.systemjob.SystemJobService<\/package_name><\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;\"><span style=\"font-family: inherit;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">The full list of variations of worker-held wake lock names is available in <\/span><a href=\"https:\/\/developer.android.com\/develop\/background-work\/background-tasks\/awake\/wakelock\/identify-wls#wake_lock_names_6\" style=\"text-decoration-line: none;\"><span face=\"Arial, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">documentation<\/span><\/a><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">. To debug these wake locks, you can use Background Task Inspector to debug locally, or leverage getStopReason to debug issues in the field.\u00a0<\/span><\/span><\/p>\n<p><\/span><b><span style=\"font-size: medium;\">Android Studio Background Task Inspector<\/span><\/b><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;\"><img decoding=\"async\" src=\"https:\/\/blogger.googleusercontent.com\/img\/a\/AVvXsEhISpitdV1spcizjG3uIhT7gejs7OBk1qyaXgKwp9jTf74HpYlvZ9SBVc_q-6IQW9iC86wdiheSKQCf6aN-Dloc51cnLAaMl5LXa7_cDxxywspQx2za-cOjcA0bagWDWVXIwdItUk1g5P_cr-EjnazamfNc6NUXFmHV7nd8nN0sYtUWpB9vZFwv5eRu_f8=s16000\"\/><\/p>\n<p><i>Screen capture of the Background Task Inspector, where it has been able to identify a worker \u201cWeatherSyncWorker\u201d that has frequently retried and failed.<\/i><\/p>\n<p><span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">For local debugging of <\/span><span style=\"color: #188038; font-family: &quot;Roboto Mono&quot;, monospace; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">WorkManager<\/span><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> issues, use this tool on an emulator or connected device (API level 26+). It shows a list of workers and their statuses (finished, executing, enqueued), allowing you to inspect details and understand worker chains.\u00a0<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">For instance, it can reveal if a worker is frequently failing or retrying due to hitting system limitations.\u00a0<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">See <\/span><a href=\"https:\/\/developer.android.com\/studio\/inspect\/task\" style=\"text-decoration-line: none;\"><span face=\"Arial, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">Background Task Inspector documentation<\/span><\/a><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> for more details.<\/span><\/p>\n<p><\/span><b><span style=\"font-size: medium;\">WorkManager getStopReason<\/span><\/b><span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">For in-field debugging of workers with excessive wake locks, use <\/span><a href=\"https:\/\/developer.android.com\/reference\/androidx\/work\/WorkInfo#getStopReason()\" style=\"text-decoration-line: none;\"><span style=\"background-color: #f8f9fa; color: #1e8e3e; font-family: &quot;Roboto Mono&quot;, monospace; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">WorkInfo.getStopReason()<\/span><\/a><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> on WorkManager 2.9.0+ or for JobScheduler, <\/span><a href=\"https:\/\/developer.android.com\/reference\/android\/app\/job\/JobParameters#getStopReason()\" style=\"text-decoration-line: none;\"><span style=\"background-color: #f8f9fa; color: #1e8e3e; font-family: &quot;Roboto Mono&quot;, monospace; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">JobParameters.getStopReason()<\/span><\/a><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> available on SDK 31+.\u00a0<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">This API helps log the reason why a worker stopped (e.g., <\/span><span style=\"color: #188038; font-family: &quot;Roboto Mono&quot;, monospace; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">STOP_REASON_TIMEOUT<\/span><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">, <\/span><span style=\"color: #188038; font-family: &quot;Roboto Mono&quot;, monospace; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">STOP_REASON_QUOTA<\/span><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">), pinpointing issues like frequent timeouts due to exhausting runtime duration.<\/span><\/p>\n<p><!--HTML generated using hilite.me--><\/p>\n<pre style=\"line-height: 125%; margin: 0px;\"><span\/>backgroundScope.<span style=\"color: #0000cc;\">launch<\/span><span style=\"color: #bbbbbb;\"> <\/span>{\n<span style=\"color: #bbbbbb;\">    <\/span>WorkManager.<span style=\"color: #0000cc;\">getInstance<\/span>(context)\n<span style=\"color: #bbbbbb;\">        <\/span>.<span style=\"color: #0000cc;\">getWorkInfoByIdFlow<\/span>(workRequest.<span style=\"color: #0000cc;\">id<\/span>)\n<span style=\"color: #bbbbbb;\">        <\/span>.<span style=\"color: #0000cc;\">collect<\/span><span style=\"color: #bbbbbb;\"> <\/span>{<span style=\"color: #bbbbbb;\"> <\/span>workInfo<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">-&gt;<\/span>\n<span style=\"color: #bbbbbb;\">            <\/span>logStopReason(workRequest.<span style=\"color: #0000cc;\">id<\/span>,<span style=\"color: #bbbbbb;\"> <\/span>workInfo<span style=\"color: #333333;\">?.<\/span><span style=\"color: #0000cc;\">stopReason<\/span>)\n<span style=\"color: #bbbbbb;\">        <\/span>}\n}\n<\/pre>\n<p><\/span><\/p>\n<h2 dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 2pt; margin-top: 14pt;\">Debugging other types of excessive wake locks<\/h2>\n<p>For more complex scenarios involving manually held wake locks or APIs holding the wake lock, we recommend you use system trace collection to debug.<\/p>\n<p><b><span style=\"font-size: medium;\">System trace collection<\/span><\/b><span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; vertical-align: baseline; white-space-collapse: preserve;\">A system trace <\/span><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">is a powerful debugging tool that captures a detailed record of system activity over a period, providing insights into CPU state, thread activity, network activity, and battery-related metrics like job duration and wake lock usage.<\/span><\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">You can capture a system trace using several methods:\u00a0<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span face=\"Arial, sans-serif\" style=\"font-size: 11pt; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"><span style=\"border: none; display: inline-block; height: 294px; overflow: hidden; width: 468px;\"><img decoding=\"async\" src=\"https:\/\/blogger.googleusercontent.com\/img\/a\/AVvXsEhdMxkoyUoXbJfS5OH0UPxoMwuzD62VMejk1FehB5ekomYWNTWrGrxDkUsnpfZz477lLnQMGgbRfopywIiBObyXpb2j7_ZmG3dtuDZXuyMjRGWng2mA0KXjjRLPGzh5h9TT_rj2rqHvFPGdHgb14svof_KtHZeIUxB6Rbrp0V1r1erxvmeE8tPgf045gKs=s16000\" style=\"margin-left: 0px; margin-top: 0px;\"\/><\/span><\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"><i>Enable &#8220;power:PowerManagement&#8221; Atrace category in the Perfetto UI under the Android apps &amp; svcs tab.\u00a0<\/i><\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Regardless of the chosen method, it&#8217;s crucial to ensure that you are collecting the <\/span><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; vertical-align: baseline; white-space-collapse: preserve;\">&#8220;power:PowerManagement&#8221; Atrace category<\/span><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> to enable viewing of device state tracks.\u00a0<\/span><\/span><\/p>\n<p><\/span><span style=\"font-size: medium;\"><b>Perfetto UI inspection and SQL analysis<\/b><\/span><span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">System traces can be opened and inspected in the <\/span><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; font-weight: 700; vertical-align: baseline; white-space-collapse: preserve;\">Perfetto UI<\/span><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">. When you open the trace, you will see a visualization of various processes on a timeline. The tracks we will be focused on in this guide are the ones under \u201cDevice State\u201d.<\/span><\/span><\/p>\n<p><\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><img decoding=\"async\" src=\"https:\/\/blogger.googleusercontent.com\/img\/a\/AVvXsEidvpDC_Zy6ler6D8UTZF1qkV-nQdsyGKfWXEWsPasgiKKgfGrQjNqrIIKKkU9EE4OeXYhIeB8n7syw5sPk2AkAZFrSVCEd9G7U6lPEFC_WvKIQ61Mx6-G_BTiCx56xiOOWcPwdlmD739moHO8wlidg3Cs_ddeRFLXxAt_sUwEBfyaWQng8Jdiubso39nM=s16000\"\/><\/p>\n<p><i style=\"font-family: inherit;\">Pin the tracks under \u201cDevice State\u201d such as &#8220;Top app&#8221;, &#8220;Screen state&#8221;, &#8220;Long Wake locks&#8221;, and \u201cJobs\u201d tracks to visually identify long-running wake lock slices.<\/i><\/p>\n<p style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt; text-align: left;\"><span style=\"font-family: inherit; white-space-collapse: preserve;\">Each block lists the name of the event, when the event started, and when it ended. In Perfetto, this is called a slice.<\/span><\/p>\n<p><span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\">For scalable analysis of multiple traces, you can use <span style=\"display: none;\"\/><a href=\"https:\/\/perfetto.dev\/docs\/analysis\/perfetto-sql-getting-started\" rel=\"noopener nofollow noreferrer\" target=\"_blank\"><b>Perfetto&#8217;s SQL analysis<span style=\"display: none;\"\/><\/b><\/a>. A SQL query can find all wake locks sorted by duration, helping identify the top contributors to excessive usage.<\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Here\u2019s an example query summing all the wake lock tags that occurred in the system trace, ordered by total duration:<\/span><\/p>\n<p><\/span><\/p>\n<p><!--HTML generated using hilite.me--><\/p>\n<pre style=\"line-height: 125%; margin: 0px;\"><span\/><span style=\"color: #008800; font-weight: bold;\">SELECT<\/span><span style=\"color: #bbbbbb;\"> <\/span>slice.name<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #008800; font-weight: bold;\">as<\/span><span style=\"color: #bbbbbb;\"> <\/span>name,<span style=\"color: #bbbbbb;\"> <\/span>track.name<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #008800; font-weight: bold;\">as<\/span><span style=\"color: #bbbbbb;\"> <\/span>track_name,\n<span style=\"color: #008800; font-weight: bold;\">SUM<\/span>(dur<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">\/<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #0000dd; font-weight: bold;\">100000<\/span>)<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #008800; font-weight: bold;\">as<\/span><span style=\"color: #bbbbbb;\"> <\/span>total_dur_ms\n<span style=\"color: #008800; font-weight: bold;\">FROM<\/span><span style=\"color: #bbbbbb;\"> <\/span>slice\n<span style=\"color: #008800; font-weight: bold;\">JOIN<\/span><span style=\"color: #bbbbbb;\"> <\/span>track<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #008800; font-weight: bold;\">ON<\/span><span style=\"color: #bbbbbb;\"> <\/span>slice.track_id<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span>track.id\n<span style=\"color: #008800; font-weight: bold;\">WHERE<\/span><span style=\"color: #bbbbbb;\"> <\/span>track.name<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #333333;\">=<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"background-color: #fff0f0;\">'WakeLocks'<\/span>\n<span style=\"color: #008800; font-weight: bold;\">GROUP<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #008800; font-weight: bold;\">BY<\/span><span style=\"color: #bbbbbb;\"> <\/span>slice.name,<span style=\"color: #bbbbbb;\"> <\/span>track.name\n<span style=\"color: #008800; font-weight: bold;\">ORDER<\/span><span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #008800; font-weight: bold;\">BY<\/span><span style=\"color: #bbbbbb;\"> <\/span>total_dur_ms<span style=\"color: #bbbbbb;\"> <\/span><span style=\"color: #008800; font-weight: bold;\">DESC<\/span>\n<\/pre>\n<p><span style=\"font-size: medium;\"><b>Use ProfilingManager for in-field trace collection<\/b><\/span><span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">For hard-to-reproduce issues, <\/span><span style=\"color: #188038; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">ProfilingManager<\/span><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> (added in SDK 35) is a programmatic API that allows developers to collect system traces in the field with start and end triggers. It offers more control over the start and end trigger points for profile collection and enforces system-level rate limiting to prevent device performance impact.\u00a0<\/span><\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit;\"><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">Check out the <\/span><a href=\"https:\/\/developer.android.com\/topic\/performance\/tracing\/profiling-manager\/overview\" style=\"text-decoration-line: none;\"><span face=\"Arial, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">ProfilingManager documentation<\/span><\/a><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\"> for further steps on how to implement in field system trace collection which include how to programmatically <\/span><a href=\"https:\/\/developer.android.com\/topic\/performance\/tracing\/profiling-manager\/how-to-capture\" style=\"text-decoration-line: none;\"><span face=\"Arial, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">capture a trace<\/span><\/a><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">, <\/span><a href=\"https:\/\/developer.android.com\/topic\/performance\/tracing\/profiling-manager\/retrieve-and-analyze\" style=\"text-decoration-line: none;\"><span face=\"Arial, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">analyze profiling data<\/span><\/a><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">, and use <\/span><a href=\"https:\/\/developer.android.com\/topic\/performance\/tracing\/profiling-manager\/debug-mode\" style=\"text-decoration-line: none;\"><span face=\"Arial, sans-serif\" style=\"color: #1155cc; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; text-decoration-line: underline; text-decoration-skip-ink: none; vertical-align: baseline; white-space-collapse: preserve;\">local debug commands<\/span><\/a><span face=\"Arial, sans-serif\" style=\"font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">.<\/span><\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">The system traces collected using ProfilingManager will look similar to the ones collected manually, but system processes and other app processes are redacted from the trace.<\/span><\/p>\n<p><\/span><\/p>\n<h2 style=\"text-align: left;\">Conclusion<\/h2>\n<p><span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">The excessive partial wake lock metric in Android vitals is only a small part of our ongoing commitment to supporting developers in reducing battery drain and improving app quality.\u00a0<\/span><\/p>\n<p dir=\"ltr\" style=\"line-height: 1.38; margin-bottom: 12pt; margin-top: 12pt;\"><span style=\"font-family: inherit; font-variant-alternates: normal; font-variant-east-asian: normal; font-variant-emoji: normal; font-variant-numeric: normal; font-variant-position: normal; vertical-align: baseline; white-space-collapse: preserve;\">By understanding and properly implementing wake locks, you can significantly optimize your app&#8217;s battery performance. Leveraging alternative APIs, adhering to wake lock best practices, and using powerful debugging tools such as Background Task Inspector, system traces and ProfilingManager are key to ensuring your app&#8217;s success on Google Play.<\/span><\/p>\n<p><\/span><\/div>\n<p>[ad_2]<br \/>\n<br \/><a href=\"http:\/\/android-developers.googleblog.com\/2025\/09\/guide-to-excessive-wake-lock-usage.html\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] Most of the content of this post is also available in video format, go give it a watch! Battery life is a crucial aspect<\/p>\n","protected":false},"author":1,"featured_media":348713,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[146],"tags":[],"_links":{"self":[{"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/posts\/348712"}],"collection":[{"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/comments?post=348712"}],"version-history":[{"count":0,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/posts\/348712\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/media\/348713"}],"wp:attachment":[{"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/media?parent=348712"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/categories?post=348712"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michigandigitalnews.com\/index.php\/wp-json\/wp\/v2\/tags?post=348712"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}