Questions tagged [uiaccelerometer]

The UIAccelerometer class lets you register to receive acceleration-related data from the onboard hardware. As a device moves, its hardware reports linear acceleration changes along the primary axes in three-dimensional space. You can use this data to detect both the current orientation of the device (relative to the ground) and any instantaneous changes to that orientation. Deprecated in iOS 5.0. Available in iOS 2.0 and later.

Deprecated in iOS 5.0. Available in iOS 2.0 and later. The UIAccelerometer class lets you register to receive acceleration-related data from the onboard hardware. As a device moves, its hardware reports linear acceleration changes along the primary axes in three-dimensional space. You can use this data to detect both the current orientation of the device (relative to the ground) and any instantaneous changes to that orientation. You might use instantaneous changes as input to a game or to initiate some action in your application.

You do not create accelerometer objects directly. Instead, you use the shared UIAccelerometer object to specify the interval at which you want to receive events and then set its delegate property. Upon assigning your delegate object, the accelerometer object begins delivering acceleration events to your delegate immediately at the specified interval. Events are always delivered on the main thread of your application.

The maximum frequency for accelerometer updates is based on the available hardware. You can request updates less frequently but cannot request them more frequently than the hardware maximum. Once you assign your delegate, however, updates are delivered regularly at the frequency you requested, whether or not the acceleration data actually changed. Your delegate is responsible for filtering out any unwanted updates and for ensuring that the amount of change is significant enough to warrant taking action.

For more information about the data delivered to your observer, see UIAcceleration Class Reference. For information about implementing your delegate object, see UIAccelerometerDelegate Protocol Reference.

113 questions
0
votes
1 answer

Test Whether the screen is ON/OFF in iphone

I am developing a application to test whether the iphone screen is OFF or ON and i tried the code of accelerometer that specified in stack overflow it working well for screen on status but when i turn off the screen the accelerometer is not…
NNR
  • 59
  • 1
  • 7
0
votes
1 answer

iOS 5 Detect Repeating/Continuous Shake

I am writing an app that will need to detect a users shake not only once but continuously. The idea is that a sound would play once on a single shake and the sound would loop if the device is continuously shaken. I have tested it with the both the…
Brian
  • 723
  • 1
  • 8
  • 26
0
votes
1 answer

Is There any possibility to run accelerometer while call is activated?

Hi In my project I need to call accelerometer while call is activated I use this code for calling accelerometer during call. - (void)applicationDidEnterBackground:(UIApplication *)application { if(isSlamOff == FALSE){ NSLog(@"Slame is…
Jprat
  • 39
  • 8
0
votes
1 answer

Detecting the timeframe of accelerometer detected motion

How does one detect the amount of time the device has detected motion on the accelerometer? If I wanted to detect continuous motion detection on the device such as 10 seconds of motion. How is this done? When I use the accelerometer delegate method,…
user773578
  • 1,161
  • 2
  • 13
  • 24
0
votes
1 answer

how to effectively use 'deviceMotion' of CMMotionManager to force the ball to move inside circular boundary?

I am using Chipmunk Space Manager. I have my space setup with one ball and a bunch of segments (512 in my case) joined together to make a circle. My aim is to force the ball to move in that circle as user moves the device. The faster user moves the…
0
votes
1 answer

UIAccelerometer called from subview not working

I have an "interesting" issue with the UIAccelerometer in an app for the iPad. In my UIViewController I have a method that activates the Accelerometer. This is how it looks like: -(void)startAcc{ UIAccelerometer *gForce = [UIAccelerometer…
Structurer
  • 694
  • 1
  • 10
  • 23
0
votes
1 answer

Move CCSprite(cocos2d) object in landscape mode according to acceleration values

I am preparing one game for which I want to move one object according to acceleration values, Game is in landscape mode. For game, I am using cocos2d framework, and I am changing sprite position as per acceleration values, Here is my code of…
jigneshbrahmkhatri
  • 3,627
  • 2
  • 21
  • 33
0
votes
1 answer

Is it possible for a web app to gather an iPhone's accelerometer data? If so, how?

Is it possible for a web app to gather an iPhone's accelerometer data? If so, how? I would think they might have in the Safari Web browser an API with such functionality. If it is possible could someone send me a link to pages with specific coding…
OOProg
  • 189
  • 1
  • 5
  • 16
0
votes
1 answer

UIAccelerometer, ViewControllers, and TabViewController, switching between tabs and MotionBegan not called

So I have an application that is based on a TabBarController and in one of my tabs Im using the UIAccelerometer. The problem Im seeing is that I can access and use the accelerometer just fine until I switch tabs and switch back. Say for instance…
0
votes
1 answer

Service and standby

I have a background Service that control with sensor accelerometer when the phone is upside down and if it's true phone sound. If I run the service and put my phone upside down it's ok but if I push power button and able a lock screen the phone not…
Mimmo
  • 51
  • 3
  • 5
0
votes
1 answer

Swing the iPhone like a golf club

I understand that I have to use the UIAccelerometer to detect which angles that will exist in a regular golf swing. The best equivalent that came to my mind is that I want to use the iPhone just like the Nintento Wii control. Is it possible to swing…
Fernando Redondo
  • 1,557
  • 3
  • 20
  • 38
0
votes
1 answer

What does it mean when it says expected expression before UIAccelerationValue?

//this is the code that I've written. It says "expected expression before UIAccelerationValue" on the part where it says *accelerateValuesAll = UIAccelerationValue. So, could anybody tell me what the problem is here? How do I fix it? NSNumber…
taevanbat
  • 425
  • 1
  • 8
  • 17
0
votes
3 answers

UIAccelerometer EXC_BAD_ACCESS crash on device

I am facing a bit strange problem with implementation of UIAccelerometer. I have a UITableViewController where I don't wanna use UIAccelerometer, but after pressing on of the rows I wanna activated one inside a UIViewController, everything is fine…
Vanya
  • 4,973
  • 5
  • 32
  • 57
0
votes
1 answer

How can I calibrate the accelerometer?

I'm using the accelerometer to move an object on my screen. It's only working when the iphone is flat. If I use the iPhone in another position, the object is not moving like I want (the Y axis is not well managed). So, I've to calibrate the position…
ALpesH
  • 23
  • 2
  • 7
0
votes
1 answer

How can I get a higher accelerometer sample rate

I know that this has been asked before, but I'm wondering if anyone has found a way to sample more then 100Hz with iOS 9 and iPhone 6 and 6s? thanks.
vboombatz
  • 409
  • 6
  • 17