Android登录通话之间的区别

时间:2019-05-21 22:12:56

标签: android android-permissions google-signin googlesigninaccount

这些调用之间是否有任何优势。使用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();
}

0 个答案:

没有答案