I want to add a step counter to my application. Currently, I am using Google fit to measure the number of steps a user has.
The problems that I encounter is that not all devices have a Google fit application, and even if not all users register with the application service (as a client).
So the desired stream:
- Determine if
Google fit installed. - If installed, check if the user is registered with
Google fit . - If installed and registered with the
Google fit app, check to see if the type of user account supports fitness services. (recording data such as steps) - If everything above is normal, check if the user has confirmed the Google popup.
Basically, I want to check if the user is using a suitable application (using all the above conditions), if he fails, then he will use the StepCount sensor on the device (if exists), if the sensor does not exist, he will use another sensors achieve this goal .
Here is the code I use to connect with the Google Fit API:
private void buildFitnessClient() {
You need help
Thanks.
source share