1

I am using Google API Client for fitness to retrieve user fitness data using the PHP Client library.

My usecase: To get users Total run time for the day, and also distance.

I am using the following code (sample code with key steps):

$service = new Google_Service_Fitness($google_client);
$dataSets = $service->users_dataset;
..
$aggBy->setDataTypeName("com.google.activity.segment"); 
..
$aggregates = $dataSets->aggregate('me',$aggReq);

I am using com.google.activity.segment as datatypename:

I get a response with run type with data

Activity type: 8
runtime : value in msec
no of segment: 2

Now i want to get the total distance travelled during running session,

From above response i can make out that user had 2 separate running activity, then how i can get the combined distance done by the particular activity?

Also how i can retrieve details about these in 2 running segment in details?

As said i am using PHP Client API.

Game
  • 21
  • 1

0 Answers0