congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Value
Code IndexAdd Tabnine to your IDE (free)

How to use
Value
in
com.google.android.gms.fitness.data

Best Java code snippets using com.google.android.gms.fitness.data.Value (Showing top 11 results out of 315)

origin: IBM/android-kubernetes-blockchain

  totalStepsFromDataPoints += dp.getValue(field).asInt();
} else if (field.getName().equals("distance")) {
  distanceTraveledFromDataPoints += dp.getValue(field).asFloat();
origin: jareddlc/OpenFit

Date tt = new Date(infoTo);
DataPoint pActivitySegment = dActivitySegmentDataSet.createDataPoint().setTimeInterval(infoFrom, infoTo, TimeUnit.MILLISECONDS);
pActivitySegment.getValue(Field.FIELD_ACTIVITY).setActivity(sleepAct);
dActivitySegmentDataSet.add(pActivitySegment);
origin: IBM/android-kubernetes-blockchain

  @Override
  public void onDataPoint(DataPoint dataPoint) {
    for (Field field : dataPoint.getDataType().getFields()) {
      Log.d(TAG, "Field: " + field.getName());
      Log.d(TAG, "Value: " + dataPoint.getValue(field));
      if (field.getName().equals("steps")) {
        int currentSteps = Integer.valueOf(userSteps.getText().toString());
        currentSteps = currentSteps + dataPoint.getValue(field).asInt();
        userSteps.setText(Integer.toString(currentSteps));
        // if nothing in sending in totalStepsConvertedToFitcoin
        if (totalStepsConvertedToFitcoin != null && !sendingInProgress) {
          if (currentSteps - totalStepsConvertedToFitcoin > FITCOINS_STEPS_CONVERSION) {
            sendingInProgress = true;
            // send steps to blockchain
            sendStepsToFitchain(userIdFromStorage,currentSteps);
            // insert send steps to mongo
            // insert logic for leaderboards
          }
        }
      }
    }
  }
};
origin: jareddlc/OpenFit

pSteps.getValue(Field.FIELD_STEPS).setInt(steps);
dSteps.add(pSteps);
pDistance.getValue(Field.FIELD_DISTANCE).setFloat(dist);
dDistance.add(pDistance);
pCalories.getValue(Field.FIELD_CALORIES).setFloat(cals);
dCalories.add(pCalories);
pActivitySegment.getValue(Field.FIELD_ACTIVITY).setActivity(FitnessActivities.WALKING);
dActivitySegmentDataSet.add(pActivitySegment);
origin: kochka/WeightLogger

private DataSet weightData(LinkedList<Measurement> measurements) {
 DataSource dataSource = new DataSource.Builder()
     .setAppPackageName(getContext())
     .setDataType(DataType.TYPE_WEIGHT)
     .setType(DataSource.TYPE_RAW)
     .build();
 DataSet dataSet = DataSet.create(dataSource);
 DataPoint dataPoint;
 for (Measurement measurement : measurements) {
  dataPoint = dataSet.createDataPoint().setTimestamp(measurement.getRecordedAt().getTimeInMillis(), TimeUnit.MILLISECONDS);
  dataPoint.getValue(Field.FIELD_WEIGHT).setFloat(measurement.getWeight());
  dataSet.add(dataPoint);
 }
 return dataSet;
}
origin: livroandroid/5ed

  @Override
  public void onDataPoint(DataPoint dataPoint) {
    for (Field field : dataPoint.getDataType().getFields()) {
      if (dataPoint.getDataType().equals(DataType.TYPE_STEP_COUNT_DELTA)) {
        Value val = dataPoint.getValue(field);
        Log.d("livroandroid", "Valor Pedometro: " + val);
        qtdePassos += val.asInt();
        runOnUiThread(new Runnable() {
          @Override
          public void run() {
            text.setText("Passos: " + qtdePassos);
          }
        });
      }
    }
  }
};
origin: jareddlc/OpenFit

pCalories.getValue(Field.FIELD_CALORIES).setFloat(calories);
dCalories.add(pCalories);
pDistance.getValue(Field.FIELD_DISTANCE).setFloat(distance);
dDistance.add(pDistance);
pHeartRateAVG.getValue(Field.FIELD_BPM).setFloat((float) avgHeartrate);
dHeartRateAVG.add(pHeartRateAVG);
pSteps.getValue(Field.FIELD_STEPS).setInt((int)steps);
dSteps.add(pSteps);
pActivitySegment.getValue(Field.FIELD_ACTIVITY).setActivity(act);
dActivitySegmentDataSet.add(pActivitySegment);
  pLocation.getValue(Field.FIELD_LONGITUDE).setFloat(gpsData.get(k).getLon());
  pLocation.getValue(Field.FIELD_LATITUDE).setFloat(gpsData.get(k).getLat());
  pLocation.getValue(Field.FIELD_ACCURACY).setFloat(gpsData.get(k).getAccuracy());
  pLocation.getValue(Field.FIELD_ALTITUDE).setFloat(gpsData.get(k).getAltitude());
  dLocation.add(pLocation);
  DataPoint pSpeedAVG = dSpeedAVG.createDataPoint().setTimestamp(gpsData.get(k).getTimeStamp(), TimeUnit.MILLISECONDS);
  pSpeedAVG.getValue(Field.FIELD_SPEED).setFloat(gpsData.get(k).getSpeed());
  dSpeedAVG.add(pSpeedAVG);
  pSpeedAVG.getValue(Field.FIELD_SPEED).setFloat(avgSpeed);
  dSpeedAVG.add(pSpeedAVG);
origin: kochka/WeightLogger

private DataSet bodyFatData(LinkedList<Measurement> measurements) {
 DataSource dataSource = new DataSource.Builder()
     .setAppPackageName(getContext())
     .setDataType(DataType.TYPE_BODY_FAT_PERCENTAGE)
     .setType(DataSource.TYPE_RAW)
     .build();
 DataSet dataSet = DataSet.create(dataSource);
 DataPoint dataPoint;
 for (Measurement measurement : measurements) {
  if (measurement.getBodyFat() != null) {
   dataPoint = dataSet.createDataPoint().setTimestamp(measurement.getRecordedAt().getTimeInMillis(), TimeUnit.MILLISECONDS);
   dataPoint.getValue(Field.FIELD_PERCENTAGE).setFloat(measurement.getBodyFat());
   dataSet.add(dataPoint);
  }
 }
 return dataSet;
}
origin: patloew/RxFit

private void onBucketLoaded(Bucket bucket) {
  FitnessSessionData fitnessSessionData = new FitnessSessionData();
  fitnessSessionData.name = bucket.getSession().getName();
  fitnessSessionData.appName = bucket.getSession().getAppPackageName();
  fitnessSessionData.activity = bucket.getSession().getActivity();
  fitnessSessionData.start = new Date(bucket.getSession().getStartTime(TimeUnit.MILLISECONDS));
  fitnessSessionData.end = new Date(bucket.getSession().getEndTime(TimeUnit.MILLISECONDS));
  if(bucket.getDataSet(DataType.AGGREGATE_STEP_COUNT_DELTA).getDataPoints().isEmpty()) {
    fitnessSessionData.steps = 0;
  } else {
    fitnessSessionData.steps = bucket.getDataSet(DataType.AGGREGATE_STEP_COUNT_DELTA).getDataPoints().get(0).getValue(Field.FIELD_STEPS).asInt();
  }
  if(bucket.getDataSet(DataType.AGGREGATE_CALORIES_EXPENDED).getDataPoints().isEmpty()) {
    fitnessSessionData.calories = 0;
  } else {
    fitnessSessionData.calories = (int) bucket.getDataSet(DataType.AGGREGATE_CALORIES_EXPENDED).getDataPoints().get(0).getValue(Field.FIELD_CALORIES).asFloat();
  }
  fitnessSessionDataList.add(fitnessSessionData);
}
origin: Drippler/drip-steps

  @Override
  public void run() {
    // Find steps from Fitness API
    DataReadRequest r = queryFitnessData();
    DataReadResult dataReadResult = Fitness.HistoryApi.readData(client, r).await(1, TimeUnit.MINUTES);
    boolean stepsFetched = false;
    if (dataReadResult.getBuckets().size() > 0) {
      Bucket bucket = dataReadResult.getBuckets().get(0);
      DataSet ds = bucket.getDataSet(DataType.TYPE_STEP_COUNT_DELTA);
      if (ds != null) {
        for (DataPoint dp : ds.getDataPoints()) {
          for (Field field : dp.getDataType().getFields()) {
            if (field.getName().equals("steps")) {
              stepsFetched = true;
              listener.onStepsCountFetched(dp.getValue(field).asInt());
            }
          }
        }
      }
    }
    if (!stepsFetched) {
      // No steps today yet or no fitness data available
      listener.onStepsCountFetched(0);
    }
  }
});
origin: kochka/WeightLogger

private DataSet basalMetabolicRate(LinkedList<Measurement> measurements) {
 DataSource dataSource = new DataSource.Builder()
     .setAppPackageName(getContext())
     .setDataType(DataType.TYPE_BASAL_METABOLIC_RATE)
     .setType(DataSource.TYPE_RAW)
     .build();
 DataSet dataSet = DataSet.create(dataSource);
 DataPoint dataPoint;
 for (Measurement measurement : measurements) {
  if (measurement.getDailyCalorieIntake() != null) {
   dataPoint = dataSet.createDataPoint().setTimestamp(measurement.getRecordedAt().getTimeInMillis(), TimeUnit.MILLISECONDS);
   dataPoint.getValue(Field.FIELD_CALORIES).setFloat(measurement.getDailyCalorieIntake().floatValue());
   dataSet.add(dataPoint);
  }
 }
 return dataSet;
}
com.google.android.gms.fitness.dataValue

Most used methods

  • asInt
  • asFloat
  • setFloat
  • setActivity
  • setInt

Popular in Java

  • Reactive rest calls using spring rest template
  • findViewById (Activity)
  • getApplicationContext (Context)
  • setContentView (Activity)
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JFrame (javax.swing)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now