Reputation: 3575
I am working on google+ integration in android.I Integrate all setting and code.but it will display error as unknown issue with google play service. how can i resolve?
my code as below:
google_api_client = new GoogleApiClient.Builder(this)
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API,Plus.PlusOptions.builder().build())
.addScope(Plus.SCOPE_PLUS_LOGIN)
.build();
Your answer would be appreciated
Upvotes: 1
Views: 83
Reputation: 4950
You need to enable the Google+ API in Google Developers Console. Under API Manager
, select Credentials
then the OAuth consent screen tab, put all necessary credentials.
If you haven't already registered your application with the Google Developers Console then set up a project and application in the Developers Console
In a terminal, run the Keytool utility to get the SHA1
fingerprint for your digitally signed .apk file's public certificate.
keytool -exportcert -alias androiddebugkey -keystore path-to-debug-or-production-keystore -list -v
Authorization for the Google Drive Android API is handled by the GoogleApiClient. This is typically created in an activity's onCreate() method.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstance);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
}
After you create the client, you must connect it for authorization to occur.
@Override
protected void onStart() {
super.onStart();
mGoogleApiClient.connect();
}
Upvotes: 3