简体   繁体   中英

How to remove Battery Optimization restrictions for Device Owner app

Battery optimization settings creates some difficulties for the device owner app I am currently developing, such as not receiving BOOT_COMPLETED broadcast in MIUI. I want to know if there is any way of removing restrictions of device owner app programmatically, like granting permissions to the device owner app itself. I could not find about this anywhere or alternative solution to the similar problems, such as keeping background services alive and auto starting services on boot.

I didn't find a way to whitelist an app from doze mode silently and programatically. The only option is to ask user of the app to do it for you.

The intent action that takes the user to Battery Optimization settings to do this is described here: https://developer.android.com/training/monitoring-device-state/doze-standby#support_for_other_use_cases

I have seen other MDMs using this approach too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM