4

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....

First Link

Second Link

Third Link

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;
    }
}
Community
  • 1
  • 1
Satheesh
  • 723
  • 7
  • 18

4 Answers4

2

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...

Juniper
  • 712
  • 1
  • 12
  • 23
Arul Pandian
  • 1,685
  • 15
  • 20
  • Are you testing the same app on two different machines? – Ojonugwa Jude Ochalifu Jan 11 '14 at 08:35
  • ya Ojonugwa Ochalifu i'm already tested its working. i got a same error like internal error. i changed sha1 key and developer console page create new project and enter project name and sha1 key to enable deeplinking. its working fine . – Arul Pandian Jan 13 '14 at 07:41
  • That was what i was going to ask you to do, the SHA1 key only works for one machine. – Ojonugwa Jude Ochalifu Jan 13 '14 at 10:34
  • oh ya only work one machine. if u want another machine u create another client id. – Arul Pandian Jan 13 '14 at 10:45
  • If you have already set your SHA1 fingerprint (debug or release) in your google developer console and you still having this problem, check if you effectively build with your key, here is the way to set the key in Android Studio: http://stackoverflow.com/a/17992232/2486332 – quent Mar 22 '16 at 20:25
1

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

user1546570
  • 287
  • 3
  • 13
0

I solved my problem. Recreate a sha1 key with password android. Now this working fine to me. So problem is in creating sha1 key.

Satheesh
  • 723
  • 7
  • 18
0

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: enter image description here

Community
  • 1
  • 1
Penzzz
  • 2,814
  • 17
  • 23