Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get the charge status of a connected iPhone from the Mac?

In iTunes, you can see the charge status of the iPhone currently connected:

Screenshot of iTunes showing an iPhone in the list of devices with the charge status indicated.

This updates as the phone charges, and even shows when the phone is done charging.

Is there a way I can discover the charge status programmatically from the Mac? Any programming language or API is fine.

like image 713
Rufo Sanchez Avatar asked Dec 15 '10 18:12

Rufo Sanchez


People also ask

How do I show the charging status on my iPhone?

See the iPhone battery percentage in the status bar On an iPhone with Face ID: Swipe down from the top-right corner. On an iPhone with a Home button: Go to Settings > Battery, then turn on Battery Percentage.

How do I show my charging status?

From the Home screen, tap the Apps Key > Settings > Battery. The battery level (as a percentage of fully charged) and the battery status (Charging or Discharging) is displayed at the top of the screen.


1 Answers

I would recommend setting up a bonjour service in an App on the iOS device to communicate with the computer. The app will then communicate the changes in the batter status using the batteryMonitoringEnabled property of UIDevice. Take a look at the samples code here.

BatteryStatus Sample Code

And here is the class reference

UIDevice Class Reference

And finally Bonjour programming

Bonjour programming guide

like image 194
Joe Avatar answered Sep 17 '22 23:09

Joe