内部错误发生时,谷歌整合加 [英] Internal error occur when integrating google plus

查看:92
本文介绍了内部错误发生时,谷歌整合加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发One Google+整合application.I参考了Google+官方tutorial.My问题是,当我在按钮当时preSS符号就分别用吐司消息错误内部错误发生。我不知道为什么这个错误发生,我看到下面的链接,但没有得到任何输出....

<一个href=\"http://stackoverflow.com/questions/18503865/android-sign-in-via-google-plus-an-internal-error-has-occured\">First链接

二环线

<一个href=\"http://stackoverflow.com/questions/15762904/an-internal-error-occurred-at-time-of-integration-of-google-plus\">Third链接

 进口android.app.Activity;
进口android.app.ProgressDialog;
进口android.content.Intent;
进口android.content.IntentSender.SendIntentException;
进口android.os.Bundle;
进口android.util.Log;
进口android.view.Menu;
进口android.widget.Toast;
进口com.example.bluetoothsocialsharing.R;
进口com.google.android.gms.common.ConnectionResult;
进口com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks;
进口com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener;
进口com.google.android.gms.plus.PlusClient;
公共类GooglePlusActivity扩展活动实现ConnectionCallbacks,OnConnectionFailedListener
{    //静态最终的String [] = SCOPES新的String [] {} Scopes.PLUS_PROFILE;    @覆盖
    保护无效的onStop(){
        super.onStop();
        mPlusClient.disconnect();
    }
    / * @覆盖
    保护无效的onDestroy(){
        super.onDestroy();
        mPlusClient.disconnect();
    } * /
    @覆盖
    保护无效调用onStart(){
        super.onStart();
        mPlusClient.connect();
    }
        私有静态最后弦乐TAG =为ExampleActivity;
        私有静态最终诠释REQUEST_ code_RESOLVE_ERR = 9000;
        私人ProgressDialog mConnectionProgressDialog;
        私人PlusClient mPlusClient;
        私人ConnectionResult mConnectionResult;    @覆盖
    保护无效的onCreate(捆绑savedInstanceState){
        super.onCreate(savedInstanceState);
        的setContentView(R.layout.activity_google_plus);
        mPlusClient =新PlusClient.Builder(这,这,这)
        .setVisibleActivities(\"http://schemas.google.com/AddActivity\",\"http://schemas.google.com/BuyActivity\")
        。建立();
        // mPlusClient =新PlusClient(这个,这​​个,这个,范围);
        如果连接故障未解决,显示//进度条。
        mConnectionProgressDialog =新ProgressDialog(本);
        mConnectionProgressDialog.setMessage(登录...);
        mConnectionProgressDialog.show();
    }    @覆盖
    公共布尔onCreateOptionsMenu(菜单菜单){
        //充气菜单;如果是present这增加了项目操作栏。
        。getMenuInflater()膨胀(R.menu.google_plus,菜单);
        返回true;
    }    @覆盖
    公共无效onConnectionFailed(ConnectionResult结果){
        Log.i(TAG,ConnectionResult:+结果);
      如果(mConnectionProgressDialog.isShowing()){
        //用户已经点击了登录按钮。开始解决
        //连接错误。等到onConnected()驳回
        //连接对话框。
        如果(result.hasResolution()){
          尝试{
                Log.i(TAGEnterTryBlock);
                   result.startResolutionForResult(这一点,REQUEST_ code_RESOLVE_ERR);
           }赶上(SendIntentException E){
               Log.i(TAGEnterCatchBlock);
                   mPlusClient.connect();
           }
        }
      }
      //保存结果,并解决在用户点击连接失败。
      setmConnectionResult(结果);
    }    @覆盖
    保护无效的onActivityResult(INT申请code,INT响应code,意图意图){
        如果(要求code == REQUEST_ code_RESOLVE_ERR&放大器;&安培;响应code == RESULT_OK){
            setmConnectionResult(NULL);
            mPlusClient.connect();
        }
    }    @覆盖
    公共无效onConnected(捆绑connectionHint){
        串帐户名= mPlusClient.getAccountName();
        Toast.makeText(这一点,帐户名+连接,Toast.LENGTH_LONG).show();
    }
    @覆盖
    公共无效onDisconnected(){
        Log.d(TAG,断开连接);
    }    公共ConnectionResult getmConnectionResult(){
        返回mConnectionResult;
    }    公共无效setmConnectionResult(ConnectionResult mConnectionResult){
        this.mConnectionResult = mConnectionResult;
    }
}


解决方案

我解决我的问题。
重新创建具有密码的android一个SHA1密钥。现在这个工作没什么问题。所以,问题是在创造SHA1密钥。

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;
    }
}

解决方案

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

这篇关于内部错误发生时,谷歌整合加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆