Skip to content Skip to sidebar Skip to footer

Google Fit Api Steps Returns 0 For Some Users

I am developing an android app that will count steps for users. I am using google fitness api to do so. I have enabled fitness api in my developer console and link my app to that.

Solution 1:

Google Fitness API is not connected to the account you use for the developer console. The console certificates are connected to the app, hence why you specify the SHA-1 keystore and package name when getting the OAuth 2.0 certificate. I tried this with a colleague and the OAuth certificate he generated on another account for our app worked when I used it as well.

Perhaps the problem is that you're signed in to the wrong account on your second device. Google Fitness data is connected to your Google account and should be accessible cross-devices and platforms, but if you're not in the right account you obviously won't be able to fetch your fitness history.

As Lovis said, I believe counting steps is opt-in, so you'd have to login to something that subscribes to your Google Fit steps account to start recording step counts on a second device. However, you should still be able to read from another device without opting in to the Recording API.

Edit: In addition to what I said above, if you're sure you're connected to the same account you might see what this SO question says: to use DataReadRequest.Builder.enableServerQueries() as documented here.

Enable querying the Google Fit server to fetch query results, in case the local store doesn't have data for the full requested time range.

Post a Comment for "Google Fit Api Steps Returns 0 For Some Users"