0
即時通訊嘗試使用google pluse自動登錄。PlusClient onConnected沒有觸發
我使用SignInButton按鈕小部件。
當我點擊日誌中我看到進度對話框,但onConnected是沒有得到triggred
這是我BUTTOM按代碼:
case R.id.sign_in_button:
{
if(!mPlusClient.isConnected())
{
if (mConnectionResult == null) {
{
pDialog = new ProgressDialog(RegisterPage.this);
pDialog.setMessage("logging in...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
} else {
try {
mConnectionResult.startResolutionForResult(this, REQUEST_CODE_RESOLVE_ERR);
} catch (SendIntentException e) {
// Try connecting again.
mConnectionResult = null;
mPlusClient.connect();
}
}
break;
}
我onConnected代碼:
@Override
public void onConnected(Bundle arg0) {
// TODO Auto-generated method stub
Log.i("ok", "ok");
if (mPlusClient.getCurrentPerson() != null && isNetworkAvailable())
new GooglePlusRegister().execute();
else
{
if(pDialog != null)
pDialog.dismiss();
Toast.makeText(getApplicationContext(),"No internet connection", Toast.LENGTH_SHORT).show();
}
}
的進度對話框不dissarityng,我沒有看到我的日誌調用。
在我的onCreate:
mPlusClient = new PlusClient.Builder(this, this , this).setScopes(Scopes.PLUS_LOGIN).setVisibleActivities("http://schemas.google.com/AddActivity", "http://schemas.google.com/BuyActivity").build();
進口:再次
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.common.Scopes;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.plus.PlusClient;
import com.google.android.gms.plus.model.people.Person;
我現在看到它,謝謝。 – dasdasd