sagarkothari
sagarkothari

Reputation: 24810

Find out a bump force in iPhone

I have to develop an application. I have to put an indicator like speedometer in the bike.

iPhone is put in the corner of a Car.

The iPhone is in a placed in a car, from where it can't be dropped anywhere and can't be moved even. ( There is a special place in car where user place iPhone ).

Now, Car is going on a smooth way.

Indicator indicates zero - that is smooth way.

Suppose, a bump is passed by the car.

These movement should be tracked by iPhone. If bump is huge:

If bump is low:

else:

I know how to add shake handler, as given in following link: accelerometer range in iPhone

But here iPhone is not going to be shake? It is in fixed place.

What should be the solution?

Upvotes: 0

Views: 468

Answers (2)

slf
slf

Reputation: 22777

You'll need to use the UIAccelerometer, UIAccelerometerDelegate, and UIAcceleration classes. Here is some Sample Code.

Upvotes: 5

Andy Mikula
Andy Mikula

Reputation: 16780

The iPhone will be shaking - it's attached to the car, and the car will be shaking. You should be able to use the same code as you would if you were shaking it with your hand.

Upvotes: 3

Related Questions