当前位置: 首页>>代码示例>>Java>>正文


Java OptionalPendingResult.get方法代码示例

本文整理汇总了Java中com.google.android.gms.common.api.OptionalPendingResult.get方法的典型用法代码示例。如果您正苦于以下问题:Java OptionalPendingResult.get方法的具体用法?Java OptionalPendingResult.get怎么用?Java OptionalPendingResult.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.common.api.OptionalPendingResult的用法示例。


在下文中一共展示了OptionalPendingResult.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onStart

import com.google.android.gms.common.api.OptionalPendingResult; //导入方法依赖的package包/类
@Override
public void onStart(){
    super.onStart();

    OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
    if (opr.isDone()) {
        // If the user's cached credentials are valid, the OptionalPendingResult will be "done"
        // and the GoogleSignInResult will be available instantly.
        Log.d(TAG, "Got cached sign-in");
        GoogleSignInResult result = opr.get();
        handleSignInResult(result);

    } else {
        // If the user has not previously signed in on this device or the sign-in has expired,
        // this asynchronous branch will attempt to sign in the user silently.  Cross-device
        // single sign-on will occur in this branch.
        opr.setResultCallback(new ResultCallback<GoogleSignInResult>() {
            @Override
            public void onResult(GoogleSignInResult googleSignInResult) {
                handleSignInResult(googleSignInResult);
            }
        });
    }
}
 
开发者ID:AviralGarg1993,项目名称:VR-One,代码行数:25,代码来源:SignInActivity.java

示例2: onStart

import com.google.android.gms.common.api.OptionalPendingResult; //导入方法依赖的package包/类
@Override
protected void onStart() {
    super.onStart();
    OptionalPendingResult<GoogleSignInResult> pendingResult = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
    if(pendingResult.isDone()){
        Log.d(TAG,"onStart(): Cached sign in");
        GoogleSignInResult result = pendingResult.get();
        handleSignInResult(result);
    } else {
        showProgressDialog();
        pendingResult.setResultCallback(new ResultCallback<GoogleSignInResult>() {
            @Override
            public void onResult(@NonNull GoogleSignInResult googleSignInResult) {
                hideProgressDialog();
                handleSignInResult(googleSignInResult);
            }
        });
    }
}
 
开发者ID:CSI-KJSCE,项目名称:CSI-KJSCEOfficial,代码行数:20,代码来源:LoginActivity.java

示例3: onStart

import com.google.android.gms.common.api.OptionalPendingResult; //导入方法依赖的package包/类
@Override
public void onStart() {
    super.onStart();
    mAuth.addAuthStateListener(mAuthListener);

    OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
    if (opr.isDone()) {
        // If the user's cached credentials are valid, the OptionalPendingResult will be "done"
        // and the GoogleSignInResult will be available instantly.
        Log.d(TAG, "Got cached sign-in");
        GoogleSignInResult result = opr.get();
        handleSignInResult(result);
    } else {
        // If the user has not previously signed in on this device or the sign-in has expired,
        // this asynchronous branch will attempt to sign in the user silently.  Cross-device
        // single sign-on will occur in this branch.

        opr.setResultCallback(new ResultCallback<GoogleSignInResult>() {
            @Override
            public void onResult(GoogleSignInResult googleSignInResult) {

                handleSignInResult(googleSignInResult);
            }
        });
    }
}
 
开发者ID:othreecodes,项目名称:WaJeun,代码行数:27,代码来源:MainActivity.java

示例4: onStart

import com.google.android.gms.common.api.OptionalPendingResult; //导入方法依赖的package包/类
@Override
public void onStart() {
    super.onStart();

    OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
    if (opr.isDone()) {
        // If the user's cached credentials are valid, the OptionalPendingResult will be "done"
        // and the GoogleSignInResult will be available instantly.
        Log.d(TAG, "Got cached sign-in");
        GoogleSignInResult result = opr.get();
        handleSignInResult(result);
    } else {
        // If the user has not previously signed in on this device or the sign-in has expired,
        // this asynchronous branch will attempt to sign in the user silently.  Cross-device
        // single sign-on will occur in this branch.
        showProgressDialog();
        opr.setResultCallback(new ResultCallback<GoogleSignInResult>() {
            @Override
            public void onResult(GoogleSignInResult googleSignInResult) {
                hideProgressDialog();
                handleSignInResult(googleSignInResult);
            }
        });
    }
}
 
开发者ID:igrow-systems,项目名称:igrow-android,代码行数:26,代码来源:SignInActivity.java

示例5: onStart

import com.google.android.gms.common.api.OptionalPendingResult; //导入方法依赖的package包/类
@Override
public void onStart() {
    super.onStart();

    OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
    if (opr.isDone()) {
        // If the user's cached credentials are valid, the OptionalPendingResult will be "done"
        // and the GoogleSignInResult will be available instantly.
        Log.d(TAG, "Got cached sign-in");
        GoogleSignInResult result = opr.get();
        handleSignInResult(result);
    } else {
        // If the user has not previously signed in on this device or the sign-in has expired,
        // this asynchronous branch will attempt to sign in the user silently.  Cross-device
        // single sign-on will occur in this branch.
        opr.setResultCallback(new ResultCallback<GoogleSignInResult>() {
            @Override
            public void onResult(@NonNull GoogleSignInResult googleSignInResult) {
                hideProgressDialog();
                handleSignInResult(googleSignInResult);
            }
        });
    }
}
 
开发者ID:Wisebite,项目名称:wisebite_android,代码行数:25,代码来源:LoginActivity.java

示例6: handleSilentSignIn

import com.google.android.gms.common.api.OptionalPendingResult; //导入方法依赖的package包/类
private void handleSilentSignIn(){

        OptionalPendingResult<GoogleSignInResult> pendingResult = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);

        if (pendingResult.isDone()) {
            // If the user's cached credentials are valid, the OptionalPendingResult will be "done"
            // and the GoogleSignInResult will be available instantly.
            Log.d(Utils.TAG, "Got cached sign-in");
            GoogleSignInResult result = pendingResult.get();
            handleSignInResult(result);
        } else {
            pendingResult.setResultCallback(new ResultCallback<GoogleSignInResult>() {
                @Override
                public void onResult(@NonNull GoogleSignInResult googleSignInResult) {
                    handleSignInResult(googleSignInResult);
                }
            });
        }
    }
 
开发者ID:NordicSemiconductor,项目名称:Android-nRF-Beacon-for-Eddystone,代码行数:20,代码来源:UpdateFragment.java

示例7: onStart

import com.google.android.gms.common.api.OptionalPendingResult; //导入方法依赖的package包/类
@Override
public void onStart() {
    super.onStart();

    OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
    if (opr.isDone()) {
        // If the user's cached credentials are valid, the OptionalPendingResult will be "done"
        // and the GoogleSignInResult will be available instantly.
        GoogleSignInResult result = opr.get();
        handleGoogleSignInResult(result);
    } else {
        // If the user has not previously signed in on this device or the sign-in has expired,
        // this asynchronous branch will attempt to sign in the user silently.  Cross-device
        // single sign-on will occur in this branch.
        mAuthProgressDialog.show();
        opr.setResultCallback(new ResultCallback<GoogleSignInResult>() {
            @Override
            public void onResult(GoogleSignInResult googleSignInResult) {
                handleGoogleSignInResult(googleSignInResult);
            }
        });
    }

    mFirebaseRef.addAuthStateListener(mAuthStateListener);
}
 
开发者ID:trigor74,项目名称:travelers-diary,代码行数:26,代码来源:LoginActivity.java

示例8: onStart

import com.google.android.gms.common.api.OptionalPendingResult; //导入方法依赖的package包/类
public void onStart() {
	OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
	if (opr.isDone()) {
		// If the user's cached credentials are valid, the OptionalPendingResult will be "done"
		// and the GoogleSignInResult will be available instantly.
		AppLogger.debug("Got cached sign-in");
		GoogleSignInResult result = opr.get();
		handleSignInResult(result);
	} else {
		// If the user has not previously signed in on this device or the sign-in has expired,
		// this asynchronous branch will attempt to sign in the user silently.  Cross-device
		// single sign-on will occur in this branch.
		showProgressDialog();
		opr.setResultCallback(new ResultCallback<GoogleSignInResult>() {
			@Override
			public void onResult(GoogleSignInResult googleSignInResult) {
				hideProgressDialog();
				handleSignInResult(googleSignInResult);
			}
		});
	}
}
 
开发者ID:NovaViper,项目名称:TrinityLocker,代码行数:23,代码来源:AuthManager.java

示例9: onResume

import com.google.android.gms.common.api.OptionalPendingResult; //导入方法依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
    if (opr.isDone()) {
        // If the user's cached credentials are valid, the OptionalPendingResult will be "done"
        // and the GoogleSignInResult will be available instantly.
        Log.d(TAG, "Got cached sign-in");
        GoogleSignInResult result = opr.get();
        handleSignInResult(result);
    } else {
        // If the user has not previously signed in on this device or the sign-in has expired,
        // this asynchronous branch will attempt to sign in the user silently.  Cross-device
        // single sign-on will occur in this branch.
        showProgressDialog();
        opr.setResultCallback(new ResultCallback<GoogleSignInResult>() {
            @Override
            public void onResult(GoogleSignInResult googleSignInResult) {
                hideProgressDialog();
                handleSignInResult(googleSignInResult);
            }
        });
    }
}
 
开发者ID:asifali22,项目名称:Focus-Android-App,代码行数:25,代码来源:LoginActivity.java

示例10: onStart

import com.google.android.gms.common.api.OptionalPendingResult; //导入方法依赖的package包/类
@Override
protected void onStart() {
    super.onStart();
    OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
    if (opr.isDone()) {
        // If the user's cached credentials are valid, the OptionalPendingResult will be "done"
        // and the GoogleSignInResult will be available instantly.
        Log.d(TAG, "Got cached sign-in");
        GoogleSignInResult result = opr.get();
        handleSignInResult(result);
    } else {
        // If the user has not previously signed in on this device or the sign-in has expired,
        // this asynchronous branch will attempt to sign in the user silently.  Cross-device
        // single sign-on will occur in this branch.
        showProgressDialog();
        opr.setResultCallback(new ResultCallback<GoogleSignInResult>() {
            @Override
            public void onResult(GoogleSignInResult googleSignInResult) {
                hideProgressDialog();
                handleSignInResult(googleSignInResult);
            }
        });
    }
}
 
开发者ID:asifali22,项目名称:Focus-Android-App,代码行数:25,代码来源:LoginActivity.java

示例11: SingInIntent

import com.google.android.gms.common.api.OptionalPendingResult; //导入方法依赖的package包/类
public void SingInIntent() {
    OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
    if (opr.isDone()) {
        // If the user's cached credentials are valid, the OptionalPendingResult will be "done"
        // and the GoogleSignInResult will be available instantly.
        Log.d(TAG, "Got cached sign-in");
        GoogleSignInResult result = opr.get();
        handleSignInResult(result);
    } else {
        // If the user has not previously signed in on this device or the sign-in has expired,
        // this asynchronous branch will attempt to sign in the user silently.  Cross-device
        // single sign-on will occur in this branch.
        showProgressDialog();
        opr.setResultCallback(new ResultCallback<GoogleSignInResult>() {
            @Override
            public void onResult(GoogleSignInResult googleSignInResult) {
                hideProgressDialog();
                handleSignInResult(googleSignInResult);
            }
        });
    }
}
 
开发者ID:asifali22,项目名称:Focus-Android-App,代码行数:23,代码来源:LoginActivity.java

示例12: confirmCredential

import com.google.android.gms.common.api.OptionalPendingResult; //导入方法依赖的package包/类
@Override
public Bundle confirmCredential(AccountAuthenticatorResponse response, Account account, Bundle data) {
    final Bundle bundle = new Bundle();
    if (TextUtils.isEmpty(data.getString(AccountManager.KEY_AUTHTOKEN))) {
        final OptionalPendingResult<GoogleSignInResult> pendingResult = GoogleApiAdapter.getInstance().performSilentSignIn();
        if (pendingResult != null) {
            final GoogleSignInResult googleSignInResult = pendingResult.get();
            if (googleSignInResult != null) {
                final GoogleSignInAccount signInAccount = googleSignInResult.getSignInAccount();
                if (signInAccount != null) {
                    bundle.putString(AccountManager.KEY_AUTHTOKEN, signInAccount.getIdToken());
                    bundle.putString(AccountManager.KEY_ACCOUNT_NAME, signInAccount.getDisplayName());
                }
            }
        }
    } else {
        bundle.putString(AccountManager.KEY_AUTHTOKEN, data.getString(AccountManager.KEY_AUTHTOKEN));
    }
    bundle.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
    bundle.putString(AccountManager.KEY_ACCOUNT_TYPE, AuthenticAuthenticator.ACCOUNT_TYPE);
    bundle.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, !TextUtils.isEmpty(bundle.getString(AccountManager.KEY_AUTHTOKEN)));
    return bundle;
}
 
开发者ID:Sefford,项目名称:BeAuthentic,代码行数:24,代码来源:GoogleStrategy.java

示例13: onStart

import com.google.android.gms.common.api.OptionalPendingResult; //导入方法依赖的package包/类
@Override
public void onStart() {
    OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
    if (opr.isDone()) {
        // If the user's cached credentials are valid, the OptionalPendingResult will be "done"
        // and the GoogleSignInResult will be available instantly.
        Config.debug(TAG, "Got cached sign-in");
        GoogleSignInResult result = opr.get();
        handleSignInResult(result);

    } else {
        // If the user has not previously signed in on this device or the sign-in has expired,
        // this asynchronous branch will attempt to sign in the user silently.  Cross-device
        // single sign-on will occur in this branch.
        Config.debug(TAG, "New sign-in");
        showProgressDialog();
        opr.setResultCallback(new ResultCallback<GoogleSignInResult>() {
            @Override
            public void onResult(GoogleSignInResult googleSignInResult) {
                hideProgressDialog();
                handleSignInResult(googleSignInResult);
            }
        });
    }
}
 
开发者ID:nishant-git,项目名称:social-api,代码行数:26,代码来源:GoogleService.java

示例14: onStart

import com.google.android.gms.common.api.OptionalPendingResult; //导入方法依赖的package包/类
@Override
public void onStart() {
  super.onStart();

  OptionalPendingResult<GoogleSignInResult> opr =
      Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
  if (opr.isDone()) {
    // If the user's cached credentials are valid, the OptionalPendingResult will be "done"
    // and the GoogleSignInResult will be available instantly.
    Log.d(TAG, "Got cached sign-in. isConnected: " + mGoogleApiClient.isConnected());
    GoogleSignInResult result = opr.get();
    handleSignInResult(result);
  } else {
    // If the user has not previously signed in on this device or the sign-in has expired,
    // this asynchronous branch will attempt to sign in the user silently.  Cross-device
    // single sign-on will occur in this branch.
    opr.setResultCallback(
        new ResultCallback<GoogleSignInResult>() {
          @Override
          public void onResult(GoogleSignInResult googleSignInResult) {
            handleSignInResult(googleSignInResult);
          }
        });
  }
}
 
开发者ID:amorris13,项目名称:triples,代码行数:26,代码来源:BaseTriplesActivity.java

示例15: onStart

import com.google.android.gms.common.api.OptionalPendingResult; //导入方法依赖的package包/类
public void onStart() {
    OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
    if (opr.isDone()) {
        // If the user's cached credentials are valid, the OptionalPendingResult will be "done"
        // and the GoogleSignInResult will be available instantly.
        if (BuildConfig.DEBUG) {
            Log.d(MCXApplication.LOG_TAG, "Got cached sign-in");
        }
        GoogleSignInResult result = opr.get();
        handleSignInResult(result);
    } else {
        // If the user has not previously signed in on this device or the sign-in has expired,
        // this asynchronous branch will attempt to sign in the user silently.  Cross-device
        // single sign-on will occur in this branch.
        //showProgressDialog();
        opr.setResultCallback(new ResultCallback<GoogleSignInResult>() {
            @Override
            public void onResult(GoogleSignInResult googleSignInResult) {
                //hideProgressDialog();
                handleSignInResult(googleSignInResult);
            }
        });
    }
}
 
开发者ID:Michenux,项目名称:YourAppIdea,代码行数:25,代码来源:GoogleAuthDelegate.java


注:本文中的com.google.android.gms.common.api.OptionalPendingResult.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。