We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have implemented code as below, but it's taken time to return steps data in iOS.
const weeks = 4; const interval = 'hour'; const tonigth = new Date(); // Set date to midnight tonight: tonigth.setHours(0, 0, 0, 0); tonigth.setDate(tonigth.getDate() + 1); const weekAgo = new Date( tonigth.getTime() - weeks * 7 * 24 * 60 * 60 * 1000, ); const startDate = Start ? Start : weekAgo.toString(); const endDate = End ? End : tonigth.toString(); const fetchSteps = async () => { const steps = await Fitness.getSteps({startDate, endDate, interval}); console.log('steps :', steps); return steps.map(step => { return { ...step, startDate: moment(step.startDate).toDate(), endDate: moment(step.endDate).toDate(), }; }); }; const permissions = [ { kind: Fitness.PermissionKinds.Steps, access: Fitness.PermissionAccesses.Read, }, ]; const authorized = await Fitness.isAuthorized(permissions); if (authorized) { if (Platform.OS === 'android') { return fetchSteps(); } else { return fetchSteps(); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have implemented code as below, but it's taken time to return steps data in iOS.
The text was updated successfully, but these errors were encountered: