Open danylokiz opened 6 years ago
It won't work after iOS 10
@mice007 Ok, so what can I use instead of it? Maybe, You know? I wanna to receive result like with this app.
At the moment, nothing, so far. I don't know any ways to get battery details which is "Apple Friendly" so you can upload to the store.
@mice007 Hmm, "Apple Friendly" what do You mean?
I mean a code which can be uploaded to the App Store without getting your ass kicked out of there.
So, I can't use like another api, yes?
But I saw other apps in the App Store, which work nice and they're still there
the problem is there is no public API or anything documented (SDK) by Apple about this. You cannot use private API in the store.
Not for long, i quess
But, what API that apps use?
@danylokiz Could you please provide the names of some of those apps that are still working?
@eldade Sure, for example, Battery Life, Battery Saver...
@danylokiz As far as I can tell, Battery Saver only shows current charge state (same as what you get on the status bar), but really nothing else. Battery Life is directly calling IOKit to get the data. You can check out a sample I have at https://github.com/eldade/EEIOKitListener to see what kind of data they're getting.
Here's the difference: rather than directly calling IOKit the way my sample does it, they are doing run-time linking to avoid detection. For example, instead of directly calling something like IORegistryEntryCreateCFProperties, they are using dlsym() to look the symbol up in runtime and then they just call it.
Is it possible to do something for iOS like CoconutBattery for macOS?
By the way, since iOS 10 (I think), Apple has dramatically reduced the info available from the IOKit PMU charger dictionary. Nowadays it looks like this:
{
AdapterInfo = 16384;
AtCriticalLevel = 0;
BatteryInstalled = 1;
CurrentCapacity = 2240;
ExternalChargeCapable = 1;
ExternalConnected = 1;
FullyCharged = 0;
IOClass = AppleARMPMUCharger;
IsCharging = 1;
MaxCapacity = 2800;
Voltage = 4085;
}
Is it possible to find out the temperature of the battery and cycle count?
@danylokiz @eldade did you find any ways to get the battery health since the recent restrictions? I'm curious about the dlsym()
runtime technic if you have any resources about it.
Moreover, it seems that the list was completely killed by iOS 12 too: https://github.com/eldade/EEIOKitListener/issues/2
I'm running an app on iPhone 5s and my iOS is 11.3. So, this is what is get:
batteryDesignCapacity=0 batteryCycleCount=0 batteryMaximumCapacity=0 batteryHealth=1.000000 batteryRawBatteryLevel=1.000000 voltage=0.000000 isPluggedIn=0 isCharging=0 isFullyCharged=0 batteryTemperature=0.000000 adapterAmperage=0 adapterWattage=0 chargerConfiguration=0 chargingAmperage=0 dischargeAmperage=0 devicePowerConsumption=0.000000
Does anybody know how to solve it?