I want to detect the event when the iOS device goes to sleep and the screen blackens?
Is there any way to do it?
Brighten your iPad with a colorful cover, stream to your TV, download pictures from your digital camera, and more. There’s already so much you can do with iPad and iPad mini
The incredibly thin Apple Wireless Keyboard uses Bluetooth technology, which makes it compatible with iPad
iPad inspires creativity and hands-on learning with features you won’t find in any other educational tool
Apple announces 4th generation iPad packing an A6X CPU
I want to detect the event when the iOS device goes to sleep and the screen blackens?
Is there any way to do it?
I want to detect the event when the iOS device goes to sleep and the screen blackens?
Is there any way to do it?
I want to detect the lock/unlock events in the device, so far I got the darwin notifications as given below,:
-(void)registerForDarwinNotif
{
//Screen lock notifications
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), //center
NULL, // observer
displayStatusChanged, // callback
CFSTR("com.apple.iokit.hid.displayStatus"), // event name
NULL, // object
CFNotificationSuspensionBehaviorDeliverImmediately);
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), //center
NULL, // observer
displayStatusChanged, // callback
CFSTR("com.apple.springboard.lockstate"), // event name
NULL, // object
CFNotificationSuspensionBehaviorDeliverImmediately);
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), //center
NULL, // observer
displayStatusChanged, // callback
CFSTR("com.apple.springboard.hasBlankedScreen"), // event name
NULL, // object
CFNotificationSuspensionBehaviorDeliverImmediately);
}
//My call back
static void displayStatusChanged(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo)
{
NSLog(@"IN Display status changed");
// you might try inspecting the `userInfo` dictionary, to see
// if it contains any useful info
NSLog(@"Darwin notification NAME = %@",name);
}
I am able to get the darwin notifications when device is locked/unlocked, but the real problem is how identify between if the notification has come from locking or the unlocking of the device. Console logs are:
Jan 10 11:29:01 Frost-bank LockDetectDemo[2086]
Jan 10 11:29:01 Frost-bank LockDetectDemo[2086]
Jan 10 11:29:01 Frost-bank LockDetectDemo[2086]
Jan 10 11:29:01 Frost-bank LockDetectDemo[2086]
Jan 10 11:29:01 Frost-bank LockDetectDemo[2086]
Jan 10 11:29:01 Frost-bank LockDetectDemo[2086]
Jan 10 11:29:01 Frost-bank LockDetectDemo[2086]
Jan 10 11:29:01 Frost-bank LockDetectDemo[2086]
Hi All,
I have used GPS location updates in my application. I want to detect if the iOS device is in sleep mode so that I can turn off the GPS and optimize the battery use. I have already tried pausesLocationupdates in iOS 6, but it does not work as desired.
I want to turn off the GPS as soon as the device goes to sleep mode. Is there any way to achieve this functionality ?
Thanks in advance.
Hi All,
I have used GPS location updates in my application. I want to detect if the iOS device is in sleep mode so that I can turn off the GPS and optimize the battery use. I have already tried pausesLocationupdates in iOS 6, but it does not work as desired.
I want to turn off the GPS as soon as the device goes to sleep mode. Is there any way to achieve this functionality ?
Thanks in advance.