Codota Logo
Value.asInt
Code IndexAdd Codota to your IDE (free)

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

Best Java code snippets using com.google.android.gms.fitness.data.Value.asInt (Showing top 5 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

  @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: IBM/android-kubernetes-blockchain

  totalStepsFromDataPoints += dp.getValue(field).asInt();
} else if (field.getName().equals("distance")) {
  distanceTraveledFromDataPoints += dp.getValue(field).asFloat();
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: 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);
    }
  }
});
com.google.android.gms.fitness.dataValueasInt

Popular methods of Value

  • asFloat
  • setFloat
  • setActivity
  • setInt

Popular in Java

  • Reactive rest calls using spring rest template
  • setContentView (Activity)
  • putExtra (Intent)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
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