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


Java UserInfo.getProviderId方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:rozdoum,项目名称:social-app-android,代码行数:19,代码来源:LogoutHelper.java

示例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]
}
 
开发者ID:firebase,项目名称:snippets-android,代码行数:20,代码来源:MainActivity.java

示例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);
    }

}
 
开发者ID:Danihelsan,项目名称:MikuyConcept,代码行数:25,代码来源:SessionHandler.java

示例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;
}
 
开发者ID:ultramega,项目名称:flavordex,代码行数:22,代码来源:SettingsActivity.java

示例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();
            }
        }
    }
}
 
开发者ID:Adventech,项目名称:sabbath-school-android,代码行数:32,代码来源:SSLoginViewModel.java

示例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);
            }
        }
    }
}
 
开发者ID:brunomassa,项目名称:LuxVilla,代码行数:30,代码来源:Editprofile.java


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