- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
是否可以在不使用任何其他 SQL 数据库的情况下在 android native 中创建用户配置文件页面,因为我不擅长 JSON。
我想创建两个 Activity ,一个将向登录用户(firebase auth)和其他用户显示个人资料页面
第二种布局将用于编辑个人资料以及添加个人资料图片、全名、年龄和地址的能力(我使用了 Firebase 电话身份验证,因此无需使用电子邮件地址或密码)。
我试图获取用户 ID 并将其与其他属性一起存储到 firestore 的新集合中,但它对我不起作用。
最佳答案
像这样在 Firestore 中创建文档
DocumentReference docRef = firebaseFirestore.collection(userId).document("Profile");
docRef.get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
if (documentSnapshot.exists()) {
Log.v(TAG, "Profile exist");
getProfileData();
} else {
Log.v(TAG, "Profile is not exist");
firebaseFirestore.collection(userId).document("Profile").set(profileEntity);
}
}
});
private void getProfileData() {
DocumentReference docRef = firebaseFirestore.collection(userId).document("Profile");
docRef.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if (task.isSuccessful()) {
DocumentSnapshot document = task.getResult();
if (document != null) {
ProfileEntity profileEntity = task.getResult().toObject(ProfileEntity.class);
if (profileEntity != null) {
//show your profile data
}
} else {
Log.d(TAG, "No such document");
}
} else {
Log.d(TAG, "get failed with ", task.getException());
}
}
});
}
关于android - 如何使用 Firebase 创建用户个人资料页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52218192/
我正在使用passport.js 为我的node.js 应用程序提供OAuth 身份验证。但我确实有一个疑问: 当我在身份验证时收到配置文件对象(当您定义 OAuth 策略时)时,该对象对于所有提供商
我正在尝试对 wordpress 布局进行解码/逆向工程。我正在浏览 CSS 文件,无法弄清楚这个长长的菜单 mumbo-jumbo 是什么! 我不是要任何人检查代码,而是让我知道我在看什么。这些似乎
所以我尝试制作一个包含私有(private)配置文件的 symfony 项目,并且我使用 FriendsOfSymfony,但是如果我创建两个用户,每个人都可以看到其他人上传的文件。我尝试在多个网站上
我正在编写一个需要使用已登录 G+ 用户的公开个人资料图片的 JS 应用。 如果我有用户 ID,我可以使用 Google+ API 查询个人资料数据。 https://developers.googl
我看过很多关于 facebook 身份验证的帖子,要么是旧的,要么不能正常工作。 然而,最终我在我的项目中做了一些可行但不完全的东西。这是我要求的代码 var facebookAuth
我是一名优秀的程序员,十分优秀!