I followed below steps as this link
- I downloaded google-services.json to my app folder.
My project level gradle file :
dependencies { classpath 'com.android.tools.build:gradle:1.3.0' classpath 'com.google.gms:google-services:1.5.0-beta2' }
My app level gradle file :
apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.google.android.gms:play-services-identity:8.3.0' compile 'com.google.android.gms:play-services:8.3.0' compile 'com.google.android.gms:play-services-plus:8.3.0' compile 'com.google.android.gms:play-services-auth:8.3.0' ... }
I created OAuth 2.0 client ID for my backend server and pass this Client ID to strings.xml file.
And finally I created GoogleSignInOptions and GoogleApiClient objects as below :
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .requestIdToken(getString(R.string.server_client_id)) .build(); mGoogleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build();
But the problem is result.isSuccess() always returns false in handleSignInResult function. I'm thinking maybe I'm doing somethings wrongly in 1th or 2nd step. And my codes are almost similar to this SignInActivity.java. Any help would be appreciated.
google-services.json
:) – BNK