zorro2b
zorro2b

Reputation: 2257

Wake app when iOS device plugged in to power

Is it possible to have an app in the background notified when an iOS device is plugged in to or unplugged from power?

Upvotes: 0

Views: 150

Answers (1)

Stanislav
Stanislav

Reputation: 410

You need two functions:

CFRunLoopSourceRef IOPSNotificationCreateRunLoopSource(IOPowerSourceCallbackType callback, void *context);
// to subscrive to a notification of a power source being changed

and

CFTypeRef IOPSCopyPowerSourcesInfo(void);
// to get info about your current power source

Both are described here: IOPowerSource

I'm not sure is it going to work in background mode or not, but you can try.

Upvotes: 1

Related Questions