簡體   English   中英

當iOS設備接通電源時喚醒應用

[英]Wake app when iOS device plugged in to power

將iOS設備插入電源或從電源拔下時,是否可以在后台通知應用程序?

您需要兩個功能:

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

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

兩者都在這里描述: IOPowerSource

我不確定它是否可以在后台模式下工作,但是您可以嘗試。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM