I want to read HealthDataTypes
. Which Scope
must I set when creating GoogleApiClient
?
.addScope(new Scope(????))
I want to read HealthDataTypes
. Which Scope
must I set when creating GoogleApiClient
?
.addScope(new Scope(????))
Google Fit provides fitness API scopes here. It is a list of specific scopes from which you can choose.
Based from this documentation, Google Fit restricts write access for the data types in HealthDataTypes to only certain developers because health data is potentially sensitive. Apps need user permission to read and write data of a restricted type. Any application can read fitness data of a restricted data type, but only Google-approved applications can write data of this type. If you would like to write to a restricted data type:
google-fit-restricted@google.com
and request to be added to the whitelist of apps allowed to write data of a restricted type to Google Fit. Provide a brief description of the data types you would like access to.If the data from your application can originate from connected devices, please include the following details about your use case and connected devices:
Ok, I found the correct answer by myself.. you can create a FittnessOption object using the required data types, and the get the implied scopes for it:
GFitUtils.buildFitnessOptions(
readTypes,
writeTypes
).getImpliedScopes();
(where readTypes and writeTypes are lists of DataTypes
in this way, you won't need to harcode the values from the google fit site