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
11
votes
3 answers

Recognize current device position as flat

So I have this app Im working on where you can roll the ball around the screen by tilting the device around(accelerometer). How can I alter the code below so that I don't have to hold the phone flat and have that as my neutral balance point. What I…
4GetFullOf
  • 1,738
  • 4
  • 22
  • 47
11
votes
6 answers

How to get accelerometer data in IOS?

I am using the UIAccelerotmeterDelegate method accelerometer:didAccelerate: but recently that method has been deprecated in iOS 5.0. So what is the alternative way to get the accelerometer data? The documentation does not mention the alternative we…
NSCry
  • 1,662
  • 6
  • 23
  • 39
9
votes
1 answer

iOS detect movement of user

I want to create a simple app that draws a simple line on screen when I move my phone on the Y-axis from a start point to end point, for example from point a(0,0) to point b(0, 10) please help demo :
AITAALI_ABDERRAHMANE
  • 2,499
  • 1
  • 26
  • 31
8
votes
2 answers

Accelerometer Low Pass Filtering

Still on the BigNerdRanch iOS Development book. In the Accelerometer chapter, they first implement accelerometer tracking but it's fairly jumpy. They then suggest to apply a low pass filter to it by changing the original code: -…
Joris Ooms
  • 11,880
  • 17
  • 67
  • 124
7
votes
2 answers

Is there an iOS library to help me detect higher-level accelerometer gestures?

For example, let's say I want to detect if the user made a circle gesture so I can trigger something in my game. Is there a library that would allow me to just listen for some sort of "circleDectected" event? If there isn't, would anyone find value…
user542551
  • 71
  • 1
6
votes
1 answer

Using Android's Linear Acceleration versus applying a low pass filter

I am trying to determine the benefit of making use of Android's Linear Acceleration data as opposed to simply applying a low pass filter as presented in Androids API reference and discussed in this other stackoverflow question. I am asking as I am…
dgldy
  • 83
  • 2
  • 7
5
votes
1 answer

Accessing iPhone Accelerometer using PyObjC

I want to access the Accelerometer of my iPhone through PyObjC. Here is my Code: @objc.signature("v@:@@") def accelerometer_didAccelerate_(self, accelerometer, acceleration): msgBox =…
Chris
  • 51
  • 2
4
votes
1 answer

horizontal and vertical shake count using accelerometer in iPhone/iPad

I want to count number of shake horizontally and vertically, I have referred to UIAcceleration I have also referred to Motion Events But couldn't come up with better approach. Any kind of help is highly appreciated , code , reference, or any…
Kshitiz Ghimire
  • 1,716
  • 3
  • 18
  • 37
4
votes
2 answers

CMMotionManager vs UIAccelerometer efficiency

I've been working on an AR framework for a while now and am trying to update from UIAccelerometer (deprecated) to CMMotionManager but am running into some efficiency problems? Basically it seems like CMMotionManager is MUCH larger and slower than…
glesage
  • 955
  • 2
  • 16
  • 31
4
votes
1 answer

iOS 5 conversion UIAccelerometer

I'm using xcode 4.2 (and going to be upgrading soon) and these lines of code [[UIAccelerometer sharedAccelerometer] setUpdateInterval:(1.0 / kAccelerometerFrequency)]; [[UIAccelerometer sharedAccelerometer] setDelegate:self]; the code works but I…
SwagDev
  • 51
  • 2
3
votes
3 answers

Maximum sampling rate for accelerometer in iphone

Does anybody know that what is the maximum sampling rate of the iphone accelerometer. I want to have have high update rate. i set it to updateInterval to 1.0/ 300.0 But it seems that i am not getting that much update rate. So can any body tell me…
Abdul Samad
  • 5,748
  • 17
  • 56
  • 70
3
votes
1 answer

using CMMotionManager and UIAccelerometer

How would I go about the following: I want to capture the device's movement across space. I mean, is there a way to know using iOS frameworks where exactly the device moved in the room's 3 dimensional space? and how fast it moved? Kindly guide me to…
Tom Shved
  • 43
  • 4
3
votes
1 answer

Using the iPhone accelerometer to move a sprite along the x axis

I am working on an iPhone game using cocos2d. I am trying to use the accelerometer for movement of a sprite in portrait mode to move left and right. For some reason with the code I am using it defaults to moving right UNLESS the phone is tilted at a…
2
votes
2 answers

UIBackgroundModes and UIAccelerometer

I'm developing a navigation app which can run in the background. That's working fine thanks to setting UIAccelerometer to location. But I'd like to use the accelerometer too, to get some additional information about what the user is doing. However,…
hanno
  • 6,401
  • 8
  • 48
  • 80
2
votes
3 answers

Detecting the device upside down

what are the correct values for detecting the device upside down? I have the following and it starts detecting when the user has titled the device on its back. I use the following values float xx = -[acceleration x]; float yy = [acceleration…
user773578
  • 1,161
  • 2
  • 13
  • 24
1
2 3 4 5 6 7 8