Amacc002
Amacc002

Reputation: 5

How to use CMDeviceMotion to detect how fast my device is traveling?

I am writing an iOS app and don't want to start detecting for shake events until after my device has reached a certain speed. I know how to use CMMotionManager to get the CMAccelerationData to detect for shake events but does anyone know what i should use to detect how fast my device is moving? Either CMDeviceMoting/userAcceleration/GPS... i am just cannot find what i should do. I am writing my app in swift but answers in Objective-C will suffice as well.

Thank you for your help

Upvotes: 0

Views: 402

Answers (1)

saagarjha
saagarjha

Reputation: 2320

You could use CoreLocation and use a CLLocation's speed property. This requires the device's GPS, and will only work for somewhat large speeds.

Upvotes: 1

Related Questions