Codota Logo
Value
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
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

  • Parsing JSON documents to java classes using gson
  • getContentResolver (Context)
  • onRequestPermissionsResult (Fragment)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • Menu (java.awt)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • DataSource (javax.sql)
    A factory for connections to the physical data source that this DataSource object represents. An alt
  • JPanel (javax.swing)
  • JTable (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now