SBAccelerometerInterface is a singleton class that can deliver accelerometer events to registered clients.
Turn on accelerometer events within SpringBoard
When the SpringBoard is visible (i.e. the active display stack is empty), the accelerometer will be turned off entirely. The following code can force accelerometer events to be reported even when there is no running apps:
SBAccelerometerInterface* interface = [objc_getClass("SBAccelerometerInterface") sharedInstance]; SBAccelerometerClient* client = [[interface valueForKey:@"clients"] lastObject]; client.updateInterval = 0.1; // set to 0 to turn off. [interface updateSettings];
- Header: http://github.com/kennytm/iphone-private-frameworks/blob/master/SpringBoard/SBAccelerometerInterface.h