Steps Data receive from History api is not matched with google fit
up vote
1
down vote
favorite
I want google fit steps count in my application, for that I am using History api, provided by google. I found that steps receive from history api is not matched with google fit even if i used same code provided by google. Below is my code.
Calendar cal = Calendar.getInstance();
Date now = new Date();
cal.setTime(now);
long endTime = cal.getTimeInMillis();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
long startTime = cal.getTimeInMillis();
DataSource ESTIMATED_STEP_DELTAS = new DataSource.Builder()
.setDataType(DataType.TYPE_STEP_COUNT_DELTA)
.setType(DataSource.TYPE_DERIVED)
.setStreamName("estimated_steps")
.setAppPackageName("com.google.android.gms")
.build();
DataReadRequest readRequest = new DataReadRequest.Builder()
.aggregate(ESTIMATED_STEP_DELTAS, DataType.AGGREGATE_STEP_COUNT_DELTA)
.aggregate(DataType.TYPE_DISTANCE_DELTA, DataType.AGGREGATE_DISTANCE_DELTA)
.aggregate(DataType.TYPE_ACTIVITY_SEGMENT, DataType.AGGREGATE_ACTIVITY_SUMMARY)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build();
Task<DataReadResponse> result = Fitness.getHistoryClient(getApplicationContext(),
GoogleSignIn.getLastSignedInAccount(getApplicationContext())).readData(readRequest);
Any Help will be highly appreciated, I am stuck with this issue from long time and even not finding any proper tutorial from google.
android google-api-client google-fit google-fit-sdk
add a comment |
up vote
1
down vote
favorite
I want google fit steps count in my application, for that I am using History api, provided by google. I found that steps receive from history api is not matched with google fit even if i used same code provided by google. Below is my code.
Calendar cal = Calendar.getInstance();
Date now = new Date();
cal.setTime(now);
long endTime = cal.getTimeInMillis();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
long startTime = cal.getTimeInMillis();
DataSource ESTIMATED_STEP_DELTAS = new DataSource.Builder()
.setDataType(DataType.TYPE_STEP_COUNT_DELTA)
.setType(DataSource.TYPE_DERIVED)
.setStreamName("estimated_steps")
.setAppPackageName("com.google.android.gms")
.build();
DataReadRequest readRequest = new DataReadRequest.Builder()
.aggregate(ESTIMATED_STEP_DELTAS, DataType.AGGREGATE_STEP_COUNT_DELTA)
.aggregate(DataType.TYPE_DISTANCE_DELTA, DataType.AGGREGATE_DISTANCE_DELTA)
.aggregate(DataType.TYPE_ACTIVITY_SEGMENT, DataType.AGGREGATE_ACTIVITY_SUMMARY)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build();
Task<DataReadResponse> result = Fitness.getHistoryClient(getApplicationContext(),
GoogleSignIn.getLastSignedInAccount(getApplicationContext())).readData(readRequest);
Any Help will be highly appreciated, I am stuck with this issue from long time and even not finding any proper tutorial from google.
android google-api-client google-fit google-fit-sdk
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I want google fit steps count in my application, for that I am using History api, provided by google. I found that steps receive from history api is not matched with google fit even if i used same code provided by google. Below is my code.
Calendar cal = Calendar.getInstance();
Date now = new Date();
cal.setTime(now);
long endTime = cal.getTimeInMillis();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
long startTime = cal.getTimeInMillis();
DataSource ESTIMATED_STEP_DELTAS = new DataSource.Builder()
.setDataType(DataType.TYPE_STEP_COUNT_DELTA)
.setType(DataSource.TYPE_DERIVED)
.setStreamName("estimated_steps")
.setAppPackageName("com.google.android.gms")
.build();
DataReadRequest readRequest = new DataReadRequest.Builder()
.aggregate(ESTIMATED_STEP_DELTAS, DataType.AGGREGATE_STEP_COUNT_DELTA)
.aggregate(DataType.TYPE_DISTANCE_DELTA, DataType.AGGREGATE_DISTANCE_DELTA)
.aggregate(DataType.TYPE_ACTIVITY_SEGMENT, DataType.AGGREGATE_ACTIVITY_SUMMARY)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build();
Task<DataReadResponse> result = Fitness.getHistoryClient(getApplicationContext(),
GoogleSignIn.getLastSignedInAccount(getApplicationContext())).readData(readRequest);
Any Help will be highly appreciated, I am stuck with this issue from long time and even not finding any proper tutorial from google.
android google-api-client google-fit google-fit-sdk
I want google fit steps count in my application, for that I am using History api, provided by google. I found that steps receive from history api is not matched with google fit even if i used same code provided by google. Below is my code.
Calendar cal = Calendar.getInstance();
Date now = new Date();
cal.setTime(now);
long endTime = cal.getTimeInMillis();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
long startTime = cal.getTimeInMillis();
DataSource ESTIMATED_STEP_DELTAS = new DataSource.Builder()
.setDataType(DataType.TYPE_STEP_COUNT_DELTA)
.setType(DataSource.TYPE_DERIVED)
.setStreamName("estimated_steps")
.setAppPackageName("com.google.android.gms")
.build();
DataReadRequest readRequest = new DataReadRequest.Builder()
.aggregate(ESTIMATED_STEP_DELTAS, DataType.AGGREGATE_STEP_COUNT_DELTA)
.aggregate(DataType.TYPE_DISTANCE_DELTA, DataType.AGGREGATE_DISTANCE_DELTA)
.aggregate(DataType.TYPE_ACTIVITY_SEGMENT, DataType.AGGREGATE_ACTIVITY_SUMMARY)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build();
Task<DataReadResponse> result = Fitness.getHistoryClient(getApplicationContext(),
GoogleSignIn.getLastSignedInAccount(getApplicationContext())).readData(readRequest);
Any Help will be highly appreciated, I am stuck with this issue from long time and even not finding any proper tutorial from google.
android google-api-client google-fit google-fit-sdk
android google-api-client google-fit google-fit-sdk
edited Nov 8 at 4:44
Mike Stockdale
4,68832533
4,68832533
asked Nov 3 at 6:06
Harsh Trivedi
695622
695622
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
see the FAQ, which explain the behavior quite literally, which you're descibing.
this is possibly the closest one can get; assuming the latest Play Services installed on device:
DataSource ESTIMATED_STEP_DELTAS = new DataSource.Builder()
.setDataType(DataType.TYPE_STEP_COUNT_DELTA)
.setType(DataSource.TYPE_DERIVED)
.setStreamName("estimated_steps")
.setAppPackageName("com.google.android.gms")
.build();
DataReadRequest readRequest = new DataReadRequest.Builder()
.aggregate(ESTIMATED_STEP_DELTAS, DataType.AGGREGATE_STEP_COUNT_DELTA)
.aggregate(DataType.TYPE_DISTANCE_DELTA, DataType.AGGREGATE_DISTANCE_DELTA)
.aggregate(DataType.TYPE_CALORIES_EXPENDED, DataType.AGGREGATE_CALORIES_EXPENDED)
.aggregate(DataType.TYPE_ACTIVITY_SEGMENT, DataType.AGGREGATE_ACTIVITY_SUMMARY)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build();
it's quite the same, except TYPE_CALORIES_EXPENDED
. alternatively, you could record you own sessions - which are not just estimated_steps
, but have a unique session identifier.
add a comment |
up vote
0
down vote
I am using history api in my app and compared the output with Google FIT app, they are quite same.
val c = GregorianCalendar()
c.set(Calendar.HOUR_OF_DAY, 0) //anything 0 - 23
c.set(Calendar.MINUTE, 0)
c.set(Calendar.SECOND, 0)
var endTime = /*date.time + dayInMS*/(getCurrentUTCDate()*1000)
var startTime = (ConfigVariable.appLastUpdateTime*1000) //converting last updated data from second to MS
val readRequest = DataReadRequest.Builder()
.aggregate(DataType.TYPE_STEP_COUNT_DELTA, DataType.AGGREGATE_STEP_COUNT_DELTA)
.bucketByTime(1 , TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build()
val pendingResult = Fitness.HistoryApi.readData(mGoogleApiClient,readRequest)
pendingResult.setResultCallback(this)
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
see the FAQ, which explain the behavior quite literally, which you're descibing.
this is possibly the closest one can get; assuming the latest Play Services installed on device:
DataSource ESTIMATED_STEP_DELTAS = new DataSource.Builder()
.setDataType(DataType.TYPE_STEP_COUNT_DELTA)
.setType(DataSource.TYPE_DERIVED)
.setStreamName("estimated_steps")
.setAppPackageName("com.google.android.gms")
.build();
DataReadRequest readRequest = new DataReadRequest.Builder()
.aggregate(ESTIMATED_STEP_DELTAS, DataType.AGGREGATE_STEP_COUNT_DELTA)
.aggregate(DataType.TYPE_DISTANCE_DELTA, DataType.AGGREGATE_DISTANCE_DELTA)
.aggregate(DataType.TYPE_CALORIES_EXPENDED, DataType.AGGREGATE_CALORIES_EXPENDED)
.aggregate(DataType.TYPE_ACTIVITY_SEGMENT, DataType.AGGREGATE_ACTIVITY_SUMMARY)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build();
it's quite the same, except TYPE_CALORIES_EXPENDED
. alternatively, you could record you own sessions - which are not just estimated_steps
, but have a unique session identifier.
add a comment |
up vote
1
down vote
see the FAQ, which explain the behavior quite literally, which you're descibing.
this is possibly the closest one can get; assuming the latest Play Services installed on device:
DataSource ESTIMATED_STEP_DELTAS = new DataSource.Builder()
.setDataType(DataType.TYPE_STEP_COUNT_DELTA)
.setType(DataSource.TYPE_DERIVED)
.setStreamName("estimated_steps")
.setAppPackageName("com.google.android.gms")
.build();
DataReadRequest readRequest = new DataReadRequest.Builder()
.aggregate(ESTIMATED_STEP_DELTAS, DataType.AGGREGATE_STEP_COUNT_DELTA)
.aggregate(DataType.TYPE_DISTANCE_DELTA, DataType.AGGREGATE_DISTANCE_DELTA)
.aggregate(DataType.TYPE_CALORIES_EXPENDED, DataType.AGGREGATE_CALORIES_EXPENDED)
.aggregate(DataType.TYPE_ACTIVITY_SEGMENT, DataType.AGGREGATE_ACTIVITY_SUMMARY)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build();
it's quite the same, except TYPE_CALORIES_EXPENDED
. alternatively, you could record you own sessions - which are not just estimated_steps
, but have a unique session identifier.
add a comment |
up vote
1
down vote
up vote
1
down vote
see the FAQ, which explain the behavior quite literally, which you're descibing.
this is possibly the closest one can get; assuming the latest Play Services installed on device:
DataSource ESTIMATED_STEP_DELTAS = new DataSource.Builder()
.setDataType(DataType.TYPE_STEP_COUNT_DELTA)
.setType(DataSource.TYPE_DERIVED)
.setStreamName("estimated_steps")
.setAppPackageName("com.google.android.gms")
.build();
DataReadRequest readRequest = new DataReadRequest.Builder()
.aggregate(ESTIMATED_STEP_DELTAS, DataType.AGGREGATE_STEP_COUNT_DELTA)
.aggregate(DataType.TYPE_DISTANCE_DELTA, DataType.AGGREGATE_DISTANCE_DELTA)
.aggregate(DataType.TYPE_CALORIES_EXPENDED, DataType.AGGREGATE_CALORIES_EXPENDED)
.aggregate(DataType.TYPE_ACTIVITY_SEGMENT, DataType.AGGREGATE_ACTIVITY_SUMMARY)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build();
it's quite the same, except TYPE_CALORIES_EXPENDED
. alternatively, you could record you own sessions - which are not just estimated_steps
, but have a unique session identifier.
see the FAQ, which explain the behavior quite literally, which you're descibing.
this is possibly the closest one can get; assuming the latest Play Services installed on device:
DataSource ESTIMATED_STEP_DELTAS = new DataSource.Builder()
.setDataType(DataType.TYPE_STEP_COUNT_DELTA)
.setType(DataSource.TYPE_DERIVED)
.setStreamName("estimated_steps")
.setAppPackageName("com.google.android.gms")
.build();
DataReadRequest readRequest = new DataReadRequest.Builder()
.aggregate(ESTIMATED_STEP_DELTAS, DataType.AGGREGATE_STEP_COUNT_DELTA)
.aggregate(DataType.TYPE_DISTANCE_DELTA, DataType.AGGREGATE_DISTANCE_DELTA)
.aggregate(DataType.TYPE_CALORIES_EXPENDED, DataType.AGGREGATE_CALORIES_EXPENDED)
.aggregate(DataType.TYPE_ACTIVITY_SEGMENT, DataType.AGGREGATE_ACTIVITY_SUMMARY)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build();
it's quite the same, except TYPE_CALORIES_EXPENDED
. alternatively, you could record you own sessions - which are not just estimated_steps
, but have a unique session identifier.
answered Nov 18 at 19:10
Martin Zeitler
12.2k33560
12.2k33560
add a comment |
add a comment |
up vote
0
down vote
I am using history api in my app and compared the output with Google FIT app, they are quite same.
val c = GregorianCalendar()
c.set(Calendar.HOUR_OF_DAY, 0) //anything 0 - 23
c.set(Calendar.MINUTE, 0)
c.set(Calendar.SECOND, 0)
var endTime = /*date.time + dayInMS*/(getCurrentUTCDate()*1000)
var startTime = (ConfigVariable.appLastUpdateTime*1000) //converting last updated data from second to MS
val readRequest = DataReadRequest.Builder()
.aggregate(DataType.TYPE_STEP_COUNT_DELTA, DataType.AGGREGATE_STEP_COUNT_DELTA)
.bucketByTime(1 , TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build()
val pendingResult = Fitness.HistoryApi.readData(mGoogleApiClient,readRequest)
pendingResult.setResultCallback(this)
add a comment |
up vote
0
down vote
I am using history api in my app and compared the output with Google FIT app, they are quite same.
val c = GregorianCalendar()
c.set(Calendar.HOUR_OF_DAY, 0) //anything 0 - 23
c.set(Calendar.MINUTE, 0)
c.set(Calendar.SECOND, 0)
var endTime = /*date.time + dayInMS*/(getCurrentUTCDate()*1000)
var startTime = (ConfigVariable.appLastUpdateTime*1000) //converting last updated data from second to MS
val readRequest = DataReadRequest.Builder()
.aggregate(DataType.TYPE_STEP_COUNT_DELTA, DataType.AGGREGATE_STEP_COUNT_DELTA)
.bucketByTime(1 , TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build()
val pendingResult = Fitness.HistoryApi.readData(mGoogleApiClient,readRequest)
pendingResult.setResultCallback(this)
add a comment |
up vote
0
down vote
up vote
0
down vote
I am using history api in my app and compared the output with Google FIT app, they are quite same.
val c = GregorianCalendar()
c.set(Calendar.HOUR_OF_DAY, 0) //anything 0 - 23
c.set(Calendar.MINUTE, 0)
c.set(Calendar.SECOND, 0)
var endTime = /*date.time + dayInMS*/(getCurrentUTCDate()*1000)
var startTime = (ConfigVariable.appLastUpdateTime*1000) //converting last updated data from second to MS
val readRequest = DataReadRequest.Builder()
.aggregate(DataType.TYPE_STEP_COUNT_DELTA, DataType.AGGREGATE_STEP_COUNT_DELTA)
.bucketByTime(1 , TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build()
val pendingResult = Fitness.HistoryApi.readData(mGoogleApiClient,readRequest)
pendingResult.setResultCallback(this)
I am using history api in my app and compared the output with Google FIT app, they are quite same.
val c = GregorianCalendar()
c.set(Calendar.HOUR_OF_DAY, 0) //anything 0 - 23
c.set(Calendar.MINUTE, 0)
c.set(Calendar.SECOND, 0)
var endTime = /*date.time + dayInMS*/(getCurrentUTCDate()*1000)
var startTime = (ConfigVariable.appLastUpdateTime*1000) //converting last updated data from second to MS
val readRequest = DataReadRequest.Builder()
.aggregate(DataType.TYPE_STEP_COUNT_DELTA, DataType.AGGREGATE_STEP_COUNT_DELTA)
.bucketByTime(1 , TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build()
val pendingResult = Fitness.HistoryApi.readData(mGoogleApiClient,readRequest)
pendingResult.setResultCallback(this)
answered Nov 19 at 6:17
Rakez Bohara
112
112
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53128859%2fsteps-data-receive-from-history-api-is-not-matched-with-google-fit%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown