How can I correctly authorize two scopes: activity and location (for read) using firebase, with javascript? (Web app)

Thank you

I am using Fit REST Api and want to get all biking distance of the day.
Does anyone have sample code to do that?
I tried the following, but not able to get data.

"aggregateBy": [{
"dataTypeName": "com.google.android.apps.fitness.record.distance",
"dataSourceId": "derived:com.google.android.apps.fitness.record.distance:com.google.android.apps.fitness:personal_record_bike_distance"
"bucketByTime": { "durationMillis": 86400000 },
"startTimeMillis": 1524009600000,
"endTimeMillis": 1524096000000

I am getting calories for a week

I am getting calorie for current day is exactly like google fit show.
but for past 6 days its not exactly like google fit.

Any suggestion?

below is my code
DataReadRequest readRequest1 = null;
readRequest1 = new DataReadRequest.Builder()
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
//.setTimeRange(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(StartDate + " " + "00:00:00").getTime(), new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(EndDate + " " + "23:59:59").getTime(), TimeUnit.MILLISECONDS)

Any moderators still active on this community? No spam control.

Post has attachment
I need to fetch below mentioned data from Google Fit API :
Activity type, Speed, Distance, Steps, Duration, Start time - End time.

This is my query -
private DataReadResult getData(String start, String end) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
long startTime = -9999, endTime = -9999;
try {
Date startDate = sdf.parse(start);
Date endDate = sdf.parse(end);
startTime = startDate.getTime();
endTime = endDate.getTime();

} catch (Exception e) {

if (startTime == -9999 || endTime == -9999) {
return null;
DataSource ESTIMATED_STEP_DELTAS = new DataSource.Builder()

DataReadRequest readRequest = new DataReadRequest.Builder()
.bucketByActivitySegment(1, TimeUnit.MILLISECONDS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)

DataReadResult dataReadResult = Fitness.HistoryApi.readData(mClient, readRequest).await(1, TimeUnit.MINUTES);

return dataReadResult;

My issue is - response received from G-Fit is inconsistent. Like for some dates distance is missing, duration values is inconsistent and speed data is missing for a lot of dates.
Below is the response link -

What's the issue?

I have query sometimes while authenticating google fit the Oauth pop nerver shows up on certain devices like xiomi. What might be the reason.

Can anyone please guide me:
The way to fetch Google Fit API Data and Store in Heroku PostGRE Data Base.....i'm facing trouble in doing that....i'm new to this

I have apps NavMusic and NavCasts for Android Wear play audio directly on the watch, mainly for the purpose of listening to something while working out or running when you don't have data.

A lot of users would like to be able to have playback controls on Google Fit. I notice when I play music on my phone, the watch displays controls in Google Fit, but not when I play music directly on my watch. Is there something I have to change to get this to work or is this a feature that can be added?

Please, Can someone get me:
- a connected scale that publish automatically the weight on Google Fit
- a connected BPM that publish automatically the hearth rate on Google Fit

Noticed that adding activity doesn't count for a goal ("x time a day"). If an activity was started and finished in realtime by "Start activity", it does. It doesn't matter whether activity was added by "Add activity" in Fit app or from external app like "7 minute workout".
Is it a known bug? Any mitigations?
Wait while more posts are being loaded