Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
FirebaseAuth mAuth=FirebaseAuth.getReference();
Java
final FirebaseUser annonymsUser;
    mAuth.signInAnnonmously();
    annonymsUser=mAuth.getCurrentUser(); 
    String AnnonymsUserID=annonymsUser.getUid(); // id:OxfVLTclVqNCPq6uTIUUdzxQoar1 
    mAuth.signInWithEmailAndPassword(email,password)...{}
    String userId=mAuth.getCurrentUser().getUid(); // id:LKJDS7jhiudsoiudsdFYT453
   annonmysUser.linkWithCredential(){}  
   String AnnonymsUserID=annonymsUser.getUid();  // id: LKJDS7jhiudsoiudsdFYT453

thus id for annonymsUser geting change after this line
Java
mAuth.signInWithEmailAndPassword(email,password){} though annonymsUser is final

before : OxfVLTclVqNCPq6uTIUUdzxQoar1
 after  : LKJDS7jhiudsoiudsdFYT453

So why cant i store instance at annonymsUser?,and why it is changing though it declared final?

is there any alternate way to store the annonymsUser instance????

What I have tried:

i declared annonymsUser final though it is changing.
Posted
Updated 11-Apr-18 8:20am
v3

1 solution

we cannot store instance of FirebaseUser for future use,we will always get current one.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900