简体   繁体   中英

Programmatic access to battery information in iOS12

Apple recently created the new battery info and usage information in the Settings app. Is it possible to access this information programmatically to be used in my own app?

Unfortunately, no. UIDevice still has an isBatteryMonitoringEnabled toggle to turn on battery monitoring, which allows you to get values out of the batteryLevel and batteryState accessors and listen for the corresponding change notifications. You cannot, however, look at the proportion of battery consumed by other apps. See the documentation .

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