本文整理汇总了Java中com.google.firebase.auth.UserInfo.getProviderId方法的典型用法代码示例。如果您正苦于以下问题:Java UserInfo.getProviderId方法的具体用法?Java UserInfo.getProviderId怎么用?Java UserInfo.getProviderId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.firebase.auth.UserInfo
的用法示例。
在下文中一共展示了UserInfo.getProviderId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: signOut
import com.google.firebase.auth.UserInfo; //导入方法依赖的package包/类
public static void signOut(GoogleApiClient mGoogleApiClient, FragmentActivity fragmentActivity) {
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null) {
DatabaseHelper.getInstance(fragmentActivity.getApplicationContext())
.removeRegistrationToken(FirebaseInstanceId.getInstance().getToken(), user.getUid());
for (UserInfo profile : user.getProviderData()) {
String providerId = profile.getProviderId();
logoutByProvider(providerId, mGoogleApiClient, fragmentActivity);
}
logoutFirebase(fragmentActivity.getApplicationContext());
}
if (clearImageCacheAsyncTask == null) {
clearImageCacheAsyncTask = new ClearImageCacheAsyncTask(fragmentActivity.getApplicationContext());
clearImageCacheAsyncTask.execute();
}
}
示例2: getProviderData
import com.google.firebase.auth.UserInfo; //导入方法依赖的package包/类
private void getProviderData() {
// [START get_provider_data]
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null) {
for (UserInfo profile : user.getProviderData()) {
// Id of the provider (ex: google.com)
String providerId = profile.getProviderId();
// UID specific to the provider
String uid = profile.getUid();
// Name, email address, and profile photo Url
String name = profile.getDisplayName();
String email = profile.getEmail();
Uri photoUrl = profile.getPhotoUrl();
};
}
// [END get_provider_data]
}
示例3: saveUserInfo
import com.google.firebase.auth.UserInfo; //导入方法依赖的package包/类
@Override
public void saveUserInfo() {
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null) {
String id = "";
String name = user.getDisplayName();
String email = user.getEmail();
String photoUrl = user.getPhotoUrl().toString();
for (UserInfo profile : user.getProviderData()) {
String providerId = profile.getProviderId();
if (providerId.compareToIgnoreCase("facebook.com") == 0) {
id = profile.getUid();
break;
}
}
userInfo.put(USERINFO.ID, id);
userInfo.put(USERINFO.FIRSTNAME, name.split(" ")[0]);
userInfo.put(USERINFO.FULLNAME, name);
userInfo.put(USERINFO.IMAGE_URL, photoUrl);
userInfo.put(USERINFO.EMAIL, email);
}
}
示例4: doInBackground
import com.google.firebase.auth.UserInfo; //导入方法依赖的package包/类
@Override
protected Void doInBackground(Void... voids) {
final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if(user != null) {
for(UserInfo info : user.getProviderData()) {
switch(info.getProviderId()) {
case GoogleAuthProvider.PROVIDER_ID:
logoutGoogle();
break;
case FacebookAuthProvider.PROVIDER_ID:
logoutFacebook();
break;
case TwitterAuthProvider.PROVIDER_ID:
logoutTwitter();
break;
}
}
FirebaseAuth.getInstance().signOut();
}
return null;
}
示例5: onAuthStateChanged
import com.google.firebase.auth.UserInfo; //导入方法依赖的package包/类
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null && firebaseBugFlag) {
firebaseBugFlag = false;
for (UserInfo profile : user.getProviderData()) {
String providerId = profile.getProviderId();
if (providerId.equals(FIREBASE_PROVIDER_ID)) {
if (!user.isAnonymous()) {
if (context != null) {
String name = profile.getDisplayName();
String email = profile.getEmail();
Uri photoUrl = profile.getPhotoUrl();
String photo = photoUrl != null ? photoUrl.toString() : "";
SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = shared.edit();
editor.putString(SSConstants.SS_USER_NAME_INDEX, name);
editor.putString(SSConstants.SS_USER_EMAIL_INDEX, email);
editor.putString(SSConstants.SS_USER_PHOTO_INDEX, photo);
editor.commit();
}
}
SSEvent.track(SSConstants.SS_EVENT_APP_OPEN);
openApp();
}
}
}
}
示例6: onCreate
import com.google.firebase.auth.UserInfo; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_editprofile);
toolbar= findViewById(R.id.barprofileactivity);
toolbar.setTitle("Editar perfil");
toolbar.setNavigationIcon(R.mipmap.ic_arrow_back_white_24dp);
setSupportActionBar(toolbar);
linearLayout= findViewById(R.id.linearLayouteditprofile);
textInputLayoutusername= findViewById(R.id.text_input_username);
editTextusername= findViewById(R.id.edittextusername);
editTextuserbio= findViewById(R.id.edittextbio);
mAuth=FirebaseAuth.getInstance();
user=mAuth.getCurrentUser();
if (user !=null){
for (UserInfo userdata: user.getProviderData()) {
String userprovider=userdata.getProviderId();
if (userprovider.equals("google.com")){
textInputLayoutusername.setVisibility(View.GONE);
}
}
}
}