Features

Get access to built in iOS motion events!

Step Counting

Uses the native iOS step counter to track activity in your game. There's even a helper method to get the number of steps the user took while your game was closed!

Current Activity

Adapt your game based on the users current activity! You can check if they're walking, running, driving, or staying still.

Queries

Query the users step or activity history for the last 7 days!

Getting Started

Install the Unity package and drop the Pulse prefab into your scene, then you're ready to go.

Use Pulse.StartStepCounting() or Pulse.StartActivityUpdates() to start getting motion data!

Configuration

Availability

The only configuration that needs to be is in your own code. You must first check if the features you are attempting to use are available at runtime. To do this, simply call Pulse.isStepCountingAvailable() and/or Pulse.isActivityAvailable().

Methods

Availability

isStepCountingAvailable()

Checks if step counting is available on the users device.

isActivityAvailable()

Checks if activity updates are available on the users device.

Step Counting

StartStepCounting(int frequency)

Starts step counting, specifying how many steps must be taken before an update will return.

Step count updates are returned through the StepCountUpdate event.

StopStepCounting()

Stops monitoring for step count updates.

GetBackgroundStepCounts()

Queries the number of steps taken from the time the app was last closed to the current time. Calls QueryStepCounts internally.

Step count updates are returned through the StepCountQuery event.

QueryStepCounts(DateTime from, DateTime to)

Queries the number of steps taken between two given times.

Step count queries are returned through the StepCountQuery event.

Activity

StartActivityUpdates()

Starts receiving updates for the users current activity.

Activity updates are returned through the ActivityUpdate event.

StopActivityUpdates()

Stops monitoring for activity updates.

GetBackgroundActivityUpdates()

Queries the activities that occured from the time the app was last closed to the current time. Calls QueryActivityUpdates internally.

Activity queries are returned through the ActivityQuery event.

QueryActivityUpdates(DateTime from, DateTime to)

Queries the number of activities between two given times.

Activity queries are returned through the ActivityQuery event.

Warning

This method can be very expensive, often returning huge numbers of activities. Use with caution.

Types

PulseActivity

Activity queries and updates return PulseActivity objects. These objects are essentially a wrapper for CMMotionActivity, and expose the same properties.

current

Returns the current activity type.

Events

StepCountUpdate<int, DateTime>

Returns the total step count since monitoring began, and the timestamp of the update.

StepCountQuery<int>

Returns the results of a call to QueryStepCounts().

ActivityUpdate<PulseActivity>

Returns the latest activity update.

ActivityQuery<PulseActivity[]>

Returns the results of a call to QueryActivityUpdates().