This is the example from the reference doc:
Async.executeAsync(sparkDevice, new Async.ApiWork<SparkDevice, Integer>() {
public Integer callApi(SparkDevice sparkDevice) throws SparkCloudException, IOException {
return sparkCloud.getVariable("myVariable");
}
@Override
public void onSuccess(Integer value) {
Toaster.s(MyActivity.this, "Room temp is " + value + " degrees.");
}
@Override
public void onFailure(SparkCloudException e) {
Log.e("SOME_TAG", e);
Toaster.l(MyActivity.this, "Wrong credentials or no internet connectivity, please try again");
}
});
Could someone suggest how I can use this to get the value of a variable in String type? sparkCloud.getVariable(“myVariable”); returns int only.
From debug log I see the SDK can actually talk to the device and got the string value back, but the SDK just could not handle non-int type.
Thanks!