A simple example of how to use the Sensors API on the Android Fit platform.
- Android API Level >= 14
- Android Build Tools v29
- Android Support Repository
- Register a Google Project with an Android client per getting started instructions http://developers.google.com/fit/android/get-started
This sample uses the Gradle build system. To build this project, use the "gradlew build" command or use "Import Project" in Android Studio.
NOTE: You must register an Android client underneath a Google Project in order for the Google Fit API to become available for your app. The process ensures your app has proper consent screen information for users to accept, among other things required to access Google APIs. See the instructions for more details: http://developers.google.com/fit/android/get-started
The most common problem using these samples are sign in errors. Users can experience this after selecting a Google Account to connect to the Fit API. This can be seen in logcat.
If you encounter this error, check the following steps:
- Follow the instructions at http://developers.google.com/fit/android/get-started for registering an Android client.
- Ensure that the Fit API is enabled for your Cloud project.
- Check your credentials for your Cloud project:
- Ensure that your package name for your credentials matches the sample.
- Ensure the package name matches the
applicationId
in theapp/build.gradle
file. - Ensure the Signing-certificate fingerprint is entered correctly.
Use the following channels for support:
- Stack Overflow: http://stackoverflow.com/questions/tagged/android