find out the force in iPhone
-
20-09-2019 - |
Question
I have to develop an application. Requirement is given below.
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,
- iphone should display - huge bump - maximum indicator
If bump is low
- iphone should display - normal bump - middle at indicator
else
- iPhone should display - smooth road - zero indicator
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?
thanks for helping me in advance.
Solution
You'll need to use the UIAccelerometer, UIAccelerometerDelegate, and UIAcceleration classes. Here is some Sample Code.
OTHER TIPS
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.