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.
Leanplum.advance(state: "Level", info: level.name)
[Leanplum advanceTo:@"Level" withInfo:level.name];
Leanplum.advanceTo("Level", level.name());
Leanplum.AdvanceTo("Level", level.Name);
// Tracks a state with a numeric parameter.
Leanplum.advanceTo("Cart", {numItems: 2});
Leanplum.advanceTo("Cart", "info", {numItems: 2});
Pausing and resuming
This is useful if your game has a "pause" mode. You shouldn't call it when someone switches out of your app because that's done automatically.
Leanplum.pauseState()
Leanplum.resumeState()
[Leanplum pauseState];
[Leanplum resumeState];
Leanplum.pauseState();
Leanplum.resumeState();
Leanplum.PauseState();
Leanplum.ResumeState();
Leanplum.pauseState();
Leanplum.resumeState();
Leanplum.pauseState();
Leanplum.resumeState();
The nil / null state
This state causes the user to leave the current state and not enter another one.
Leanplum.advance(state:nil)
[Leanplum advanceTo:nil];
Leanplum.advanceTo(null);
Leanplum.AdvanceTo(null);
Leanplum.advanceTo(null);
Leanplum.advanceTo(null);