android / fit-samples

Multiple samples showing the best practices using the Fit APIs on Android.
Apache License 2.0
151 stars 113 forks source link

Google Fit API: ApiException 17 (Fitness.CLIENT is not available on this device) #15

Open codingjeremy opened 5 years ago

codingjeremy commented 5 years ago

Issue by hrsalehi Friday May 04, 2018 at 03:07 GMT Originally opened as https://github.com/googlesamples/android-fit/issues/34


I configured Google fit api and followed "Getting Started" section of google docs. But when I trying to read "Steps" data I face "Google Fit API: ApiException 17 (Fitness.CLIENT is not available on this device)" exception in Task object callback from getRecordingClient

        Fitness.getRecordingClient(context, GoogleSignIn.getLastSignedInAccount(context))
                .subscribe(DataType.TYPE_STEP_COUNT_CUMULATIVE)
                .addOnCompleteListener(
                        new OnCompleteListener<Void>() {
                            @Override
                            public void onComplete(@NonNull Task<Void> task) {
                                if (task.isSuccessful()) {
                                    Log.i(LOG_TAG, "Successfully subscribed!");
                                } else {
                                    Log.w(LOG_TAG, "There was a problem subscribing.", task.getException());
                                }
                            }
                        });
bunjix commented 4 years ago

Hey, I have lot of user with the same issue. Did you found a fix?

sagrgpt commented 4 years ago

I'm facing this issue as well. Any resolution?

mr-mamali commented 4 years ago

i was facing same issue and no refrence was available but according to : public static final int API_NOT_CONNECTED The client attempted to call a method from an API that failed to connect. Possible reasons include:

The API previously failed to connect with a resolvable error, but the user declined the resolution.
The device does not support GmsCore.
The specific API cannot connect on this device.
Constant Value: 17

from google docs , for a reason api is not available in device..

I am from Iran ! this service is restricted by google to Iranian users ! this was the reason finally ! when i using VPN for google auth the problem is resolve !

sagrgpt commented 4 years ago

@mr-mamali I have received this issue for a user from Iran as well. The exception now makes sense. Thanks for your reply.

Deveshgsk commented 3 years ago

I am getting this error; I live in India, can someone help me