Reputation: 733
I am developing one Google+ integration application.I refer the Google+ official tutorial.My problem is when i press the sign in button at that time it show one toast message error "internal error occur". I don't know why this error occur and i see the following links but not getting any output....
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.widget.Toast;
import com.example.bluetoothsocialsharing.R;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks;
import com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener;
import com.google.android.gms.plus.PlusClient;
public class GooglePlusActivity extends Activity implements ConnectionCallbacks, OnConnectionFailedListener
{
//static final String[] SCOPES = new String[] { Scopes.PLUS_PROFILE };
@Override
protected void onStop() {
super.onStop();
mPlusClient.disconnect();
}
/*@Override
protected void onDestroy() {
super.onDestroy();
mPlusClient.disconnect();
}*/
@Override
protected void onStart() {
super.onStart();
mPlusClient.connect();
}
private static final String TAG = "ExampleActivity";
private static final int REQUEST_CODE_RESOLVE_ERR = 9000;
private ProgressDialog mConnectionProgressDialog;
private PlusClient mPlusClient;
private ConnectionResult mConnectionResult;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_google_plus);
mPlusClient = new PlusClient.Builder(this, this, this)
.setVisibleActivities("http://schemas.google.com/AddActivity","http://schemas.google.com/BuyActivity")
.build();
//mPlusClient=new PlusClient(this,this,this,SCOPES);
// Progress bar to be displayed if the connection failure is not resolved.
mConnectionProgressDialog = new ProgressDialog(this);
mConnectionProgressDialog.setMessage("Signing in...");
mConnectionProgressDialog.show();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.google_plus, menu);
return true;
}
@Override
public void onConnectionFailed(ConnectionResult result) {
Log.i(TAG,"ConnectionResult:"+result);
if (mConnectionProgressDialog.isShowing()) {
// The user clicked the sign-in button already. Start to resolve
// connection errors. Wait until onConnected() to dismiss the
// connection dialog.
if (result.hasResolution()) {
try {
Log.i(TAG,"EnterTryBlock");
result.startResolutionForResult(this, REQUEST_CODE_RESOLVE_ERR);
} catch (SendIntentException e) {
Log.i(TAG,"EnterCatchBlock");
mPlusClient.connect();
}
}
}
// Save the result and resolve the connection failure upon a user click.
setmConnectionResult(result);
}
@Override
protected void onActivityResult(int requestCode, int responseCode, Intent intent) {
if (requestCode == REQUEST_CODE_RESOLVE_ERR && responseCode == RESULT_OK) {
setmConnectionResult(null);
mPlusClient.connect();
}
}
@Override
public void onConnected(Bundle connectionHint) {
String accountName = mPlusClient.getAccountName();
Toast.makeText(this, accountName + " is connected.", Toast.LENGTH_LONG).show();
}
@Override
public void onDisconnected() {
Log.d(TAG, "disconnected");
}
public ConnectionResult getmConnectionResult() {
return mConnectionResult;
}
public void setmConnectionResult(ConnectionResult mConnectionResult) {
this.mConnectionResult = mConnectionResult;
}
}
Upvotes: 4
Views: 2260
Reputation: 2993
Here one of cases, solving which it helps me run my app normaly
"An internal error occurred" with integration of Google Plus Login
so, this answer says that you should fill out "Consent screen" of left side menu in Google developers console, where u registering your app .
Here how it looks like:
Upvotes: 0
Reputation: 733
I solved my problem. Recreate a sha1 key with password android. Now this working fine to me. So problem is in creating sha1 key.
Upvotes: 0
Reputation: 1693
Satheesh,
Once goto delete that file .android/debug.keystore after restart ur eclipse. new key is there on Window -> Prefernces -> Android -> SHA1 fingerprint key u just copy that and add new project in ur console page and paste ur new key and package name. after try its working...
Upvotes: 2
Reputation: 287
I had the same problem. In the guide it says
mPlusClient = new PlusClient.Builder(this, this, this)
.setActions("http://schemas.google.com/AddActivity", "http://schemas.google.com/BuyActivity")
.setScopes("PLUS_LOGIN") // Space separated list of scopes
.build();
I changed it to this and it worked
mPlusClient = new PlusClient.Builder(this, this, this)
.setActions("http://schemas.google.com/AddActivity",
"http://schemas.google.com/BuyActivity")
.build();
If you are using Eclipse to test the app, make sure to use the SHA1 finger print in Window -> Prefernces -> Android -> Build in your Google + console
Upvotes: 1