I am using firebase phone Authentication . When a user creates a account using phone number and next time he creates account with same phone number Than I want to show a m
DatabaseReference userRef = FirebaseDatabase.getInstance().getReference("Users");
userRef
.orderByChild("phonenumber")
.equalTo(mMobile.getText().toString())
.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.getValue() != null) {
//it means user already registered
//Add code to show your prompt
OpenErrorAlrt("Mobile Number already registed");
} else {
Intent intent = new Intent(getApplicationContext(), OTPVerifyActivity.class);
intent.putExtra("phonenumber", mMobile.getText().toString());
startActivity(intent);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});