An object that manages access to the motion data stored by the device.


class CMMotionActivityManager : NSObject


Motion data reflects whether the user is walking, running, in a vehicle, or stationary for periods of time. A navigation app might look for changes in the current type of motion and offer different directions for each. Using this class, you can ask for notifications when the current type of motion changes or you can gather past motion change data.


Determining Activity Availability

class func isActivityAvailable() -> Bool

Returns a Boolean indicating whether motion data is available on the current device.

class func authorizationStatus() -> CMAuthorizationStatus

Returns a value indicating whether the app is authorized to retrieve stored motion data.

enum CMAuthorizationStatus

The authorization status for motion-related features.

Starting and Stopping Activity Updates

func startActivityUpdates(to: OperationQueue, withHandler: CMMotionActivityHandler)

Starts the delivery of current motion data updates to your app.

func stopActivityUpdates()

Stops the delivery of motion updates to your app

typealias CMMotionActivityHandler

A block that reports the current motion associated with the device.

Getting Historical Activity Data

typealias CMMotionActivityQueryHandler

A block that reports the motion updates that occurred between the specified query interval.


Inherits From

Conforms To

See Also

Historical Data

class CMMotionActivity

The data for a single motion update event.