1
private HiSportDataCallback sportDataCallback = new HiSportDataCallback() {
@Override
public void onResult(int resultCode) {
Log.i(TAG, "resultCode:" + resultCode);
combineResult(resultCode, "status changed");
}
@Override
public void onDataChanged(int state, Bundle bundle) {
StringBuilder sb = new StringBuilder();
Log.i(TAG, "onChange state: " + state);
if (state == 2) {
if (bundle != null) {
Set<String> keys = bundle.keySet();
for (String key : keys) {
sb.append("Время" + " : " + String.valueOf(bundle.get("duration"))).append("\n\r");
sb.append("Пульс" + " : " + String.valueOf(bundle.get("heartRate"))).append("\n\r");
sb.append("Шаги" + " : " + String.valueOf(bundle.get("totalSteps"))).append("\n\r");
break;
}
}
}
combineResult(state, sb.toString());
}
};