I'm trying to figure out how I would be able to force the iPhone to register that there is indeed a device plugged in. I've been trying to figure out if it is actually possible. I want it to be able to register that the device is connected and then start charging because of this. Any help/suggestions/references would be greatly appreciated.
Asked
Active
Viewed 94 times
0
-
Do you mean, you're plugging the iPhone into something with a USB port, like a laptop? – Fiddling Bits Nov 28 '13 at 02:34
-
I meant the charging device that connects to the bottom of the iphone. This could include a computer or a wall charger – user3044115 Nov 28 '13 at 02:38
-
Is your iPhone not charging? Sorry, I don't understand what you're asking. – Fiddling Bits Nov 28 '13 at 02:47
-
I'm trying to basically reinitialize the charging process without having to unplug and plug my iPhone back in. What I was wondering is if there is code that can run that can force or trick the iPhone into reinitializing the charge without having to disconnect and reconnect the charger. – user3044115 Nov 28 '13 at 02:50
-
He is asking if it is possible to make the phone think it is charging when it isn't, and whilst this is probably possible if the application accesses private APIs etc... It's not something that Apple exposes an API for. – unknowndomain Nov 28 '13 at 02:51
-
Just curiosity: when updating iOS, at some point in time we would always hear a beep, which signifies the moment when every time we connect our iPhone to the computer, after the update is unpackaged towards the end. This beep would sound without us even having to disconnect and reconnect the iPhone by the USB cable. Is it possible to achieve at least that thru code? – Unheilig Nov 28 '13 at 03:11
2 Answers
0
Apple doesn't expose an API for making the phone incorrectly think it is charging when it isn't, however the UIDevice class does allow you to detect if the device is charging using the following code:
[[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
if ([[UIDevice currentDevice] batteryState] == UIDeviceBatteryStateCharging) {
NSLog(@"Device is charging.");
}
Community
- 1
- 1
unknowndomain
- 985
- 1
- 10
- 34
0
Even with jailbreak this is largely impossible - it require I/O Kit level hacking and deploying kexts. If you have a faulty cord or a faulty charger, Apple Genius can help you.
Maxthon Chan
- 1,181
- 8
- 15