Browsing States

The thing will periodically upload its state to the Kii Cloud. You can browse these states from the mobile application. See here for the overview.

You will use the state class you've defined in the Schema Definition when getting the latest state. For example, we've defined the following AirConditionerState class for our air conditioner example in the schema definition page.

public class AirConditionerState extends TargetState {
  public boolean power;
  public int presetTemperature;
  public int fanSpeed;
  public int currentTemperature;
  public int currentHumidity;
}

The following code will update this class with the latest state:

Prior to the execution, you need to get a ThingIFAPI instance (api) that is initialized by the steps described in Initializing and Onboarding.

try {
  // Get the thing state.
  AirConditionerState state = api.getTargetState(AirConditionerState.class);
} catch (ThingIFException e) {
  // Handle the error.
}

You can get the state even if it is not updated by the thing. In this case, each field will have Java initial value (e.g., 0 and false).

You cannot query or browse state history via Thing-IF SDK for Android. Please use either REST API or developer portal.