search

Home  >  Q&A  >  body text

How to get battery information in iOS - Stack Overflow

Want to get battery-related information, such as: battery voltage, current, actual battery capacity, battery temperature...

1 Is there any way to publicly obtain this information?

I tried to use IOKit to obtain this data, but these are private APIs and may be rejected for review. Among the public APIs, Apple does not provide this interface (or I can’t find it. If you know it, please let me know. grateful).

2 If I can only use private APIs, is there any way to bypass Apple's detection of private APIs?

Can code obfuscation or other encryption methods be used in iOS to bypass review? There is really too little contact in this area. So let me ask you some advice.

过去多啦不再A梦过去多啦不再A梦2805 days ago867

reply all(2)I'll reply

  • 漂亮男人

    漂亮男人2017-05-02 09:25:19

    There are quite few official battery-related APIs. Here are all the results.
    You can only get the power and battery charging status.
    The functions you need can only be implemented by private APIs.
    UIDeviceBatteryStateDidChangeNotification
    In short, That is not possible in the public API.
    It can only be implemented using the private API in IOKit.framework
    Here is the implementation of IOKit.framework

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-02 09:25:19

    Hello, can you add QQ to communicate 1359098941

    reply
    0
  • Cancelreply