0

I am going crazy, please help me.. I've following the tutorial page, but without success,

  • I've added them from android studio
  • I've enabled the API,
  • I've got the SHA1 with the default debug keystore
  • I've created a new client ID and I've created a new key in credential section.
  • Compile and upload on phone

But nothing seems to work.

I get this stupid error: Connection Result{statusCode=unknown status code 5005, resolution=null}

Stupid and complicated developer console..

Please help me

Today it works. Probably was the wrong packing name.

SOLVED

Andy Turner
  • 137,514
  • 11
  • 162
  • 243
crc_error
  • 552
  • 1
  • 4
  • 14
  • i dont think that this error is stupid nor console, so maybe .... – Selvin Mar 17 '15 at 22:36
  • Probably the stupid is me, but why it does not work? Do you know if there is a more complete step by step procedure? I just want know how this api works – crc_error Mar 18 '15 at 06:28

1 Answers1

-1

Just change the package name .. Here is the api client

private void buildFitnessClient() {
    fitnessClient = new GoogleApiClient.Builder(context)
            .addApi(Fitness.HISTORY_API)
            .addApi(Fitness.SESSIONS_API)
            .addScope(new Scope(Scopes.FITNESS_BODY_READ_WRITE))
            .addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ_WRITE))
            .addScope(new Scope(Scopes.FITNESS_LOCATION_READ_WRITE))
            .addScope(new Scope(Scopes.FITNESS_NUTRITION_READ_WRITE))
            .addConnectionCallbacks(
                    new GoogleApiClient.ConnectionCallbacks() {
                        @Override
                        public void onConnected(Bundle bundle) {
                            ReferenceWrapper.getInstance(context)
                                    .setApiClient(fitnessClient);
                            ((OnClientConnectListener) context)
                                    .onclientConnected();
                            Log.e("Google fit", "connected");
                        }

                        @Override
                        public void onConnectionSuspended(int i) {
                        }
                    })
            .addOnConnectionFailedListener(
                    new GoogleApiClient.OnConnectionFailedListener() {
                        // Called whenever the API client fails to connect.
                        @Override
                        public void onConnectionFailed(
                                ConnectionResult result) {
                            if (!result.hasResolution()) {
                                GooglePlayServicesUtil.getErrorDialog(
                                        result.getErrorCode(), context, 0)
                                        .show();
                                return;
                            }
                            if (!authInProgress) {
                                try {
                                    authInProgress = true;
                                    result.startResolutionForResult(
                                            context,
                                            KeyConstant.REQUEST_OAUTH);
                                } catch (IntentSender.SendIntentException e) {
                                }
                            }
                        }
                    }).build();
}
ADM
  • 20,406
  • 11
  • 52
  • 83