A state is any part of your app a user can be in. For example, some states can include being in a particular level, watching a video, or browsing an in-app store. All states have a time and a duration. The duration is set automatically -- when one state begins, the previous one ends.

Advancing to a state.

This example is called when the user advances to the next level.


Pausing and resuming.

You can use this if your game has a "pause" mode. You shouldn't call it when someone switches out of your app because that's done automatically.


The 'null' state.

Causes the user to leave the current state and not enter another one.


Automatically track states for each view

// This code should appear before you display any views in your app.
// Place in the application class before calling Leanplum.start().