Я получил что-то для работы, вот образец
table_user.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
// Check user exist in database or not
if (dataSnapshot.child(userPhone).exists()) {
Toast.makeText(getApplicationContext(), "User is Exist with this phone number!!", Toast.LENGTH_SHORT).show();
et_phoneNo.setError("No is already registered");
et_phoneNo.requestFocus();
et_phoneNo.setText("");
return;
}
if (userPhone.length() < 11) {
Toast.makeText(getApplicationContext(), "Please Enter Correct Phone No", Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(userName) || TextUtils.isEmpty(userPassword) || TextUtils.isEmpty(userPhone)) {
Toast.makeText(getApplicationContext(), "Please Fill all required Field", Toast.LENGTH_SHORT).show();
} else {
PhoneAuthProvider.getInstance().verifyPhoneNumber(
userPhone, // Phone number to verify
60, // Timeout duration
TimeUnit.SECONDS, // Unit of timeout
orederondoor.com.projectorder.Shopkeeper.Shopkeeper_Pages.Sign_Up.this, // Activity (for callback binding)
mCallbacks); // OnVerificationStateChangedCallbacks
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});