This function is very difficult to develop because it depends on many factors. You better implement your own battery notifications for each particular platform. On some platforms, there is fairly complete information about power consumption and remaining battery life. This (probably) will lead to better grades and save you a lot of work :)
Example for iPhone;
UIDevice *device = [UIDevice currentDevice];
device.batteryMonitoringEnabled = YES;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(batteryChanged:) name:@"UIDeviceBatteryLevelDidChangeNotification" object:device];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(batteryChanged:) name:@"UIDeviceBatteryStateDidChangeNotification" object:device];
5% - UIDeviceBatteryLevelDidChangeNotification. , 5% , , . .
: , , , (WiFi, ..).
, , , . "" .