0
votes

I want to add a feature which shows daily steps count of user to my app. I wonder if there is a way to get steps count as Apple health provides.

Also i wonder If i use google fit sdk , will the app have to push user to install google fit app ?

Is there any good sample project to see how to use google fit sdk efficiently ?

1
Refer this, may be it will helpful. developers.google.com/fit/android/… - Nigam Patro

1 Answers

0
votes

You can subscribe to RecordingApi for step count event,it will save steps count automatically.

 Fitness.RecordingApi.subscribe(mClient, DataType.TYPE_STEP_COUNT_CUMULATIVE)
                .setResultCallback(new ResultCallback<Status>() {
                    @Override
                    public void onResult(Status status) {
//check here for success or failure.
});

And to fetch recorded data ,you can use HistoryApi.

Example:

PendingResult<DailyTotalResult> result = Fitness.HistoryApi.readDailyTotal(mClient, DataType.TYPE_STEP_COUNT_DELTA);

For complete sample Check out google repository --https://github.com/googlesamples/android-fit

Hope it helps..