Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198
SBAccelerometerInterface - iPhone Development Wiki

SBAccelerometerInterface

From iPhone Development Wiki
Revision as of 07:11, 17 November 2009 by KennyTM~ (talk | contribs) (Created page with 'SBAccelerometerInterface is a singleton class that can deliver accelerometer events to registered clients. == Turn on accelerometer events within SpringBoard == When the Sp…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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];

References