iphone - Does Apple allow to monitor springboard events? -


i trying detect when user locks device (vs. pressing home button instance).

found this:

cfnotificationcenteraddobserver(cfnotificationcentergetdarwinnotifycenter(), //center                                     null, // observer                                     lockstatechanged, // callback                                     cfstr("com.apple.springboard.lockstate"), // event name                                     null, // object                                     cfnotificationsuspensionbehaviordeliverimmediately);    static void lockstatechanged(cfnotificationcenterref center, void *observer, cfstringref name, const void *object, cfdictionaryref userinfo) {     nslog(@"event received!");     // might try inspecting `userinfo` dictionary, see     //  if contains useful info     if (userinfo != nil) {         cfshow(userinfo);     } } 

i can imagine com.apple.springboard.lockstate calling private api? or fine?

assuming cf... functions public ok, in murky area sure. next release of ios break code if apple changes string.

what did in similar situation approved shipping app avoid using string directly. create array of strings, use nsstring method combine them period separator instead of using com.apple.springboard.lockstate directly.

ymmv


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -