这些调用之间是否有任何优势。使用startActivityForResult
的版本会返回一个帐户对象,但是出于我的目的,我不需要将帐户对象保存在activity
中。
GoogleSignIn.requestPermissions
调用具有内置的隐式登录流程。仅调用GoogleSignIn.requestPermissions
就足够了吗?
谢谢!
GoogleSignInOptions signInOptions =
new GoogleSignInOptions.Builder().addExtension(getFitnessOptions()).build();
mSignInClient = GoogleSignIn.getClient(this, signInOptions);
...
Intent intent = mSignInClient.getSignInIntent();
startActivityForResult(intent, REQUEST_SIGN_IN_CODE);
// compare to
GoogleSignIn.requestPermissions(this, REQUEST_OAUTH_REQUEST_CODE, GoogleSignIn.getLastSignedInAccount(this), getFitnessOptions());
...
public static FitnessOptions getFitnessOptions() {
return FitnessOptions.builder().addDataType(DataType.TYPE_STEP_COUNT_DELTA, FitnessOptions.ACCESS_READ).addDataType(DataType.AGGREGATE_STEP_COUNT_DELTA, FitnessOptions.ACCESS_READ).build();
}