Asy*_*sym 7 android firebase firebase-authentication firebase-realtime-database
我正在使用Firebase制作一个示例笔记应用程序,用户可以登录并创建简单的文本注释.我的Firebase数据结构如下:
"Project-dir":{
"Notes":{
"UserID":{
"NoteKey":{
"title":"This is note title",
"content":"This is the note content",
"unixTime":123456789
},
"NoteKey":{
"title":"This is note title",
"content":"This is the note content",
"unixTime":123456789
},
}
}
}
Run Code Online (Sandbox Code Playgroud)
用户登录时效果很好.但是,我想添加"不登录时继续"功能.我使用push()生成唯一的用户ID,而不是使用auth UID并存储在sharedprefs中.但是,当他决定稍后登录时,如何将所有这些笔记迁移到用户的UserID(UID)?
对于此特定用例,您将需要使用Firebase身份验证的匿名身份验证提供程序.
它与现在基本相同(它为当前用户/设备生成随机ID).不同之处在于,您可以通过链接他们的Facebook/Google/Github/Email帐户,将匿名身份验证用户稍后升级为已识别的用户.