目前,我可以获取DisplayName
,Email
和uid
等信息,以及如何获取诸如@myname
和其他类似description
之类的句柄名称。
startActivityForResult:
List<AuthUI.IdpConfig> providers = Arrays.asList(
new AuthUI.IdpConfig.TwitterBuilder().build()
);
startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(providers)
.build(),1
);
onActivityResult:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1) {
IdpResponse response = IdpResponse.fromResultIntent(data);
if (resultCode == RESULT_OK) {
if (response.isNewUser())
{
String username = FirebaseAuth.getInstance().getCurrentUser().getDisplayName();
String email = FirebaseAuth.getInstance().getCurrentUser().getEmail();
}
Intent timelineIntent = new Intent(this, TimelineActivity.class);
startActivity(timelineIntent);
finish();
} else {
if (response.getError().getErrorCode() == ErrorCodes.PROVIDER_ERROR)
finish();
if (response == null)
finish();
}
}
}