在Firebase中未获取当前用户ID

时间:2019-04-10 13:29:49

标签: android firebase-authentication

我正在尝试通过电话号码使用Firebase进行验证,我想在验证活动中获取当前用户ID,以将用户ID存储在数据库中。

DatabaseReference mDatabase;
private FirebaseAuth mAuth;
String code;
String mobile;
String codesent;
//  public FirebaseAuth.AuthStateListener authListener;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_verify_phone);

    mAuth = FirebaseAuth.getInstance();
    mAuth.getInstance().getCurrentUser();
    String uId = mAuth.getUid();


    Toast.makeText(getApplicationContext(), uId,
            Toast.LENGTH_LONG).show();

    mDatabase = FirebaseDatabase.getInstance().getReference();
    sendVerificationCode();


    findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {


        @Override
        public void onClick(View v) {

            verifySignInCode();


        }
    });

}

0 个答案:

没有答案