Ask for the battery exemption only on the phones that need it A developer of the Android app QuickDial published a Kotlin OemPolicy object that requests battery-optimization exemptions only on device makers known to aggressively kill background apps, such as Xiaomi, Oppo, Vivo and Huawei, while skipping the prompt on newer Samsung and Nokia devices. The policy combines Build.MANUFACTURER and Build.BRAND with SDK-version checks, and pairs with a fallback chain of intents that tries the system exemption dialog, then the full battery settings list, then the app info page. Many Android apps that rely on a background service open the same screen on first launch: "Please turn off battery optimisation for this app." On a lot of phones that request is unnecessary, and every extra permission screen in onboarding costs you users who give up halfway. This post is about the small policy object I use instead: ask for the exemption only on phone makers known to stop background apps beyond what stock Android does. Disclosure: I'm the developer of QuickDial, the app this code comes from, and this post is published from my account. It was written and published by an AI agent working on my behalf. QuickDial is an independent app, not affiliated with WhatsApp LLC or Meta. QuickDial keeps an accessibility service and a notification listener running so it can show a call shortcut on an open chat and during a call. If the system kills those in the background, the feature quietly stops. Battery optimisation is one of the usual causes, but not on every phone. On a recent Samsung flagship the app ran fine with the default battery setting, so asking every user for the exemption would have added a scary-looking step for nothing. The decision lives in one small Kotlin object, so it can be unit-tested and changed in one place: object OemPolicy { private val maker: String get = Build.MANUFACTURER + " " + Build.BRAND .lowercase private fun isOem vararg names: String = names.any { maker.contains it } fun killsBackgroundApps : Boolean = when { isOem "samsung" - Build.VERSION.SDK INT <= Build.VERSION CODES.TIRAMISU isOem "nokia", "hmd" - Build.VERSION.SDK INT <= Build.VERSION CODES.P else - isOem "xiaomi", "poco", "redmi", "oppo", "realme", "oneplus", "vivo", "iqoo", "huawei", "honor", "meizu", "asus", "letv", "leeco", "tecno", "infinix", "itel", } } A few details worth copying: MANUFACTURER and BRAND together. The policy only decides whether the battery item counts as missing. The setup check then reads: OemPolicy.killsBackgroundApps && isIgnoringBatteryOptimizations context isIgnoringBatteryOptimizations is PowerManager.isIgnoringBatteryOptimizations packageName . On a phone outside the list, the battery item never shows up, so onboarding is one screen shorter. If the item is needed, try the system's own yes/no dialog first and fall back gracefully, because some ROMs block or remove one of these screens: fun keepRunning context: Context : List