Search code examples
iphonebattery

Read Battery Percentage of iPhone via WLAN


I found an app that shows the battery percentage of my iPhone in the menu bar (iBetterCharge). The iPhone is not connected via USB or Bluetooth (it is only connected to the same network as my Macbook).

My question is: How can I get this information? The device shows up in IOReg, but only because I connected my phone via Bluetooth once.


Solution

  • This can be done by using the unix application "libimobiledevice". I'm not sure that it works with all versions of iOS.

    //install it:
    brew install libimobiledevice
    
    //list all device
    idevice_id --list // list available device UDIDs. Normally, we have to plug the device at least once to get its UUID.
    
    //get the current syslog of device that we want to check
    idevicesyslog -u <device udid>
    
    //do some text search to get the battery info
    
    //or running ideviceinfo (I don't know if it works wirelessly)
    //run 'ideviceinfo --help' to see how it works
    ideviceinfo -u <device udid> --domain com.apple.mobile.battery
    

    More read at: https://www.theiphonewiki.com/wiki/MobileDevice_Library