Created
May 27, 2015 07:19
-
-
Save oshliaer/46b1f4920a80dbbca80d to your computer and use it in GitHub Desktop.
Lists sessions previously created #gapi #fit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getFitActivity(pageToken) { | |
var params = {}; | |
if(pageToken) params.pageToken = pageToken; | |
params.startTime = '2014-12-18T00:00:00.00Z'; | |
params.endTime = '2014-12-18T17:34:00.00Z'; | |
var request = gapi.client.request({ | |
'path' : '/fitness/v1/users/me/sessions', | |
'method' : 'GET', | |
'params' : params | |
}).then(opt_onFulfilled, opt_onRejected); | |
} | |
function opt_onRejected(e) { | |
console.log(e); | |
} | |
function opt_onFulfilled(e) { | |
console.log(e); | |
if(e.result.session) | |
for(var i = 0; i < e.result.session.length; i++){ | |
console.log(e.result.session[i].startTimeMillis); | |
console.log('st', new Date(parseFloat(e.result.session[i].startTimeMillis)), 'et', new Date(parseFloat(e.result.session[i].endTimeMillis))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Users.sessions: list