title: The format of the phone provided is incorrect
body: <p>I am trying to use phone authentication from my app. I have put up a phone edit text for one to fill in their phone number then send it to the VerificationPhone activity to be verified so as to enable one to use the app. It was working before but now i cant seem to understand why after filling in the phone number i still get the format of the phone is in correct yet i have put in the country code and number. Kindly help i cant seem to understand..</p>
  
  <p>This is the splash.class</p>
  
  <pre><code>     public class Splash extends AppCompatActivity {
  
      Button btnSignUp, btnFacebook;
      TextView tvSignIn;
      TextView textSlogan ,alreadyAnAcc;
      RelativeLayout rootLayout;
  
      String number;
      String phoneVerificationId;
      PhoneAuthProvider.OnVerificationStateChangedCallbacks verificationCallbacks;
      PhoneAuthProvider.ForceResendingToken resendingToken;
      FirebaseAuth mAuth;
      private static final String TAG = "Splash";
      FirebaseDatabase mCustomerDatabase;
      DatabaseReference db;
  
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_splash);
  
  
  
  
          tvSignIn=(TextView)findViewById(R.id.tvSignIn);
          alreadyAnAcc = (TextView)findViewById(R.id.alreadyAnAcc);
          btnSignUp=(Button)findViewById(R.id.btnSignUp);
          btnFacebook = (Button)findViewById(R.id.btnFacebook);
  
          textSlogan = (TextView)findViewById(R.id.textSlogan);
  
  
  
          tvSignIn.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  showLoginDialog();
  
  
              }
          });
  
          btnSignUp.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  showRegisterDialog();
  
              }
          });
      }
  
      private void showLoginDialog() {
          final AlertDialog.Builder dialog = new AlertDialog.Builder(this);
          dialog.setTitle("LOG IN");
          dialog.setMessage("Enter phone and password to sign in");
  
  
          LayoutInflater inflater = LayoutInflater.from(this);
          View login_layout = inflater.inflate(R.layout.content_signin,null);
  
          final EditText edtPhone = login_layout.findViewById(R.id.edtPhone);
          final EditText edtPassword = login_layout.findViewById(R.id.edtPassword);
          final TextView phoneNumber = login_layout.findViewById(R.id.phoneNum);
          final CountryCodePicker countryCodePicker = login_layout.findViewById(R.id.ccp);
  
          countryCodePicker.registerCarrierNumberEditText(edtPhone);
  
          dialog.setView(login_layout);
          //set button
  
          dialog.setPositiveButton("SIGN IN", new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialogInterface, int i) {
  
                  dialogInterface.dismiss();
  
                  //Check validation
  
                  //set signin btn enable false while processing
  
                  String mobile = edtPhone.getText().toString().trim();
  
  
  
  
                  btnSignUp.setEnabled(false);
  
  
  
                  if(mobile.isEmpty() || mobile.length() &lt; 9){
                      edtPhone.setError("Enter a valid mobile");
                      edtPhone.requestFocus();
                      return;
                  }
  
  
                  number = countryCodePicker.getFullNumberWithPlus();
  
                  Intent intent = new Intent(Splash.this, VerficationPhone.class);
                  intent.putExtra("mobile", mobile);
                  startActivity(intent);
  
                  final AlertDialog waitingDialog = new SpotsDialog(Splash.this);
                  waitingDialog.show();
  
  
  
                  waitingDialog.dismiss();
  
  
                  startActivity(new Intent(Splash.this,VerficationPhone.class));
  
  
  
  
  
  
  
  
  
  
              }
          });
  
          dialog.setNegativeButton("CANCEL", new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialogInterface, int which) {
                  dialogInterface.dismiss();
  
              }
          });
  
          dialog.show();
  
  
      }
  
      private void showRegisterDialog() {
  
          final AlertDialog.Builder dialog = new AlertDialog.Builder(this);
          dialog.setTitle("SIGN UP");
          dialog.setMessage("Please use email to sign up");
  
  
          LayoutInflater inflater = LayoutInflater.from(this);
          View register_layout = inflater.inflate(R.layout.activity_registration,null);
  
          final EditText edtEmail = register_layout.findViewById(R.id.edtEmail);
          final EditText edtPassword = register_layout.findViewById(R.id.edtPassword);
          final EditText edtPhone = register_layout.findViewById(R.id.edtPhone);
          final EditText edtFirstName = register_layout.findViewById(R.id.edtFirstName);
          final EditText edtLastName = register_layout.findViewById(R.id.edtLastName);
          final CountryCodePicker countryCodePicker = register_layout.findViewById(R.id.ccp);
  
          countryCodePicker.registerCarrierNumberEditText(edtPhone);
  
  
          dialog.setView(register_layout);
          //set button
  
          dialog.setPositiveButton("SIGN UP", new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialogInterface, int i) {
  
                  dialogInterface.dismiss();
  
                  //Check validation
  
                  String firstName = edtFirstName.getText().toString().trim();
  
  
                  if (TextUtils.isEmpty(edtFirstName.getText().toString()))
                  {
                      Snackbar.make(rootLayout,"Please enter first name", Snackbar.LENGTH_SHORT)
                              .show();
                      return;
                  }
  
                  Intent intent1 = new Intent(Splash.this,VerficationPhone.class);
                  intent1.putExtra("firstName",firstName);
                  startActivity(intent1);
  
  
                  String lastName = edtLastName.getText().toString();
  
                  if (TextUtils.isEmpty(edtLastName.getText().toString()))
                  {
                      Snackbar.make(rootLayout,"Please enter last name", Snackbar.LENGTH_SHORT)
                              .show();
                      return;
                  }
                  Intent intent2 = new Intent(Splash.this, VerficationPhone.class);
                  intent2.putExtra("lastName",lastName);
                  startActivity(intent2);
  
  
  
                  String email = edtEmail.getText().toString();
  
  
  
                  if (TextUtils.isEmpty(edtEmail.getText().toString()))
                  {
                      Snackbar.make(rootLayout,"Please enter email address", Snackbar.LENGTH_SHORT)
                              .show();
                      return;
                  }
  
  
                  Intent intent4 = new Intent(Splash.this, VerficationPhone.class);
                  intent4.putExtra("email", email);
                  startActivity(intent4);
  
  
                  String password = edtPassword.getText().toString();
  
                  if (TextUtils.isEmpty(edtPassword.getText().toString()))
                  {
                      Snackbar.make(rootLayout,"Please enter password", Snackbar.LENGTH_SHORT)
                              .show();
                      return;
                  }
  
                  Intent intent3 = new Intent(Splash.this, VerficationPhone.class);
                  intent3.putExtra("password", password);
                  startActivity(intent3);
  
                  if (TextUtils.isEmpty(edtPhone.getText().toString()))
                  {
                      Snackbar.make(rootLayout,"Please enter phone number", Snackbar.LENGTH_SHORT)
                              .show();
                      return;
                  }
                  String mobile = edtPhone.getText().toString().trim();
  
  
                  if(mobile.isEmpty() || mobile.length() &lt; 9){
                      edtPhone.setError("Enter a valid mobile");
                      edtPhone.requestFocus();
                      return;
                  }
  
  
                  number = countryCodePicker.getFullNumberWithPlus();
  
                  Intent intent = new Intent(Splash.this, VerficationPhone.class);
                  intent.putExtra("mobile", mobile);
                  startActivity(intent);
  
                  final AlertDialog waitingDialog = new SpotsDialog(Splash.this);
                  waitingDialog.show();
  
  
  
                  waitingDialog.dismiss();
  
  
                  startActivity(new Intent(Splash.this,VerficationPhone.class));
  
  
  
  
  
              }
          });
  
          dialog.setNegativeButton("CANCEL", new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialogInterface, int which) {
                  dialogInterface.dismiss();
              }
          });
  
          dialog.show();
      }
  }
  </code></pre>
  
  <p>This is the VerificationPhone.class</p>
  
  <pre><code>public class VerficationPhone extends AppCompatActivity {
  
      String mVerificationId;
  
      //The edittext to input the code
      EditText editTextCode;
  
      //firebase auth object
      FirebaseAuth mAuth;
      private static final String TAG = "PhoneAuth";
      String number;
      private PhoneAuthProvider.OnVerificationStateChangedCallbacks verificationCallbacks;
      private PhoneAuthProvider.ForceResendingToken resendingToken;
      FirebaseDatabase db;
      DatabaseReference mCustomerDatabase;
      RelativeLayout rootLayout;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_verfication);
  
          mAuth = FirebaseAuth.getInstance();
          editTextCode = (EditText) findViewById(R.id.editTextCode);
  
          mAuth = FirebaseAuth.getInstance();
          db = FirebaseDatabase.getInstance();
          mCustomerDatabase = db.getReference(Common.customer_tbl);
  
          rootLayout = (RelativeLayout)findViewById(R.id.rootLayout);
  
          //getting mobile number from the previous activity
          //and sending the verification code to the number
  
          Intent intent = getIntent();
          String mobile = intent.getStringExtra("mobile");
          sendVerificationCode(mobile);
  
  
          Intent intent1 = getIntent();
          String password = intent1.getStringExtra("password");
  
          Intent intent2 = getIntent();
          String firstName = intent2.getStringExtra("firstName");
  
          Intent intent3 = getIntent();
          String lastName = intent3.getStringExtra("lastName");
  
          Intent intent4 = getIntent();
          String email = intent4.getStringExtra("email");
  
  
  
  
          findViewById(R.id.buttonSignIn).setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  String code = editTextCode.getText().toString().trim();
                  if (code.isEmpty() || code.length() &lt; 6) {
                      editTextCode.setError("Enter valid code");
                      editTextCode.requestFocus();
                      return;
                  }
  
  
  
                  //verifying the code entered manually
                  verifyVerificationCode(code);
              }
          });
  
  
  
      }
  
  
  
  
  
      //the method is sending verification code
      //the country id is concatenated
      //you can take the country id as user input as well
      private void sendVerificationCode(String mobile) {
          PhoneAuthProvider.getInstance().verifyPhoneNumber(
                  "+254" + mobile,
                  60,
                  TimeUnit.SECONDS,
                  TaskExecutors.MAIN_THREAD,
                  mCallbacks);
      }
  
  
      //the callback to detect the verification status
      private PhoneAuthProvider.OnVerificationStateChangedCallbacks mCallbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
          @Override
          public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) {
  
              //Getting the code sent by SMS
              String code = phoneAuthCredential.getSmsCode();
  
              //sometime the code is not detected automatically
              //in this case the code will be null
              //so user has to manually enter the code
              if (code != null) {
                  editTextCode.setText(code);
                  //verifying the code
                  verifyVerificationCode(code);
              }
          }
  
  
          @Override
          public void onVerificationFailed(FirebaseException e) {
              Toast.makeText(VerficationPhone.this, e.getMessage(), Toast.LENGTH_LONG).show();
          }
  
          @Override
          public void onCodeSent(String s, PhoneAuthProvider.ForceResendingToken forceResendingToken) {
              super.onCodeSent(s, forceResendingToken);
  
              //storing the verification id that is sent to the user
              mVerificationId = s;
          }
      };
  
  
      private void verifyVerificationCode(String code) {
          //creating the credential
          PhoneAuthCredential credential = PhoneAuthProvider.getCredential(mVerificationId, code);
  
          //signing the user
          signInWithPhoneAuthCredential(credential);
      }
  
      private void signInWithPhoneAuthCredential(PhoneAuthCredential credential) {
          mAuth.signInWithCredential(credential)
                  .addOnCompleteListener(VerficationPhone.this, new OnCompleteListener&lt;AuthResult&gt;() {
                      @Override
                      public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                          if (task.isSuccessful()) {
                              //verification successful we will  the profile activity
                              Intent intent = new Intent(VerficationPhone.this, MainActivity.class);
                              intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                              startActivity(intent);
  
                          } else {
  
                              //verification unsuccessful.. display an error message
  
                              String message = "Something is wrong, kindly add your phone number again...";
  
                              if (task.getException() instanceof FirebaseAuthInvalidCredentialsException) {
                                  message = "Invalid code entered...";
                              }
  
                              Snackbar snackbar = Snackbar.make(findViewById(R.id.parent), message, Snackbar.LENGTH_LONG);
                              snackbar.setAction("Dismiss", new View.OnClickListener() {
                                  @Override
                                  public void onClick(View v) {
  
                                  }
                              });
                              snackbar.show();
                          }
                      }
                  });
      }
  
  }
  </code></pre>
  
  <p>this is the log.cat</p>
  
  <pre><code>9-18 09:16:44.421 1180-1180/? E/SamsungIME: ET9KDB_SetKdbNum : 10
  09-18 09:16:44.421 1180-1180/? E/SamsungIME: ET9KDB_GetKdbNum : 39
  09-18 09:16:44.421 1180-1180/? E/SamsungIME: ET9KDB_GetPageNum : 39
  09-18 09:16:44.421 1180-1180/? E/SamsungIME: ET9KDB_SetKdbNum : 10
  09-18 09:16:44.421 1180-1180/? E/SamsungIME: ET9KDB_GetPageNum : 39
  09-18 09:16:44.421 1180-1180/? E/SamsungIME: ET9KDB_SetMultiTapMode : 39
  09-18 09:16:44.431 1180-1180/? E/SamsungIME: ET9KDB_GetKdbNum : 39
  09-18 09:16:44.431 1180-1180/? E/SamsungIME: ET9KDB_GetPageNum : 39
  09-18 09:16:44.431 1180-1180/? E/SamsungIME: ET9KDB_SetKdbNum : 10
  09-18 09:16:44.431 1180-1180/? E/SamsungIME: ET9KDB_GetKdbNum : 39
  09-18 09:16:44.431 1180-1180/? E/SamsungIME: ET9KDB_GetPageNum : 39
  09-18 09:16:44.431 1180-1180/? E/SamsungIME: ET9KDB_SetKdbNum : 10
  09-18 09:16:44.431 1180-1180/? E/SamsungIME: ET9KDB_GetPageNum : 39
  09-18 09:16:44.431 1180-1180/? E/SamsungIME: ET9KDB_SetMultiTapMode : 39
  09-18 09:16:44.521 1180-1180/? E/SamsungIME: ET9KDB_GetKdbNum : 39
  09-18 09:16:44.521 1180-1180/? E/SamsungIME: ET9KDB_GetPageNum : 39
  09-18 09:16:44.821 1180-1180/? E/SamsungIME: NumberFormatException
  09-18 09:16:44.821 1180-1180/? E/SamsungIME: NumberFormatException
  09-18 09:16:44.831 1180-1180/? E/SamsungIME: NumberFormatException
  09-18 09:16:44.831 1180-1180/? E/SamsungIME: NumberFormatException
  09-18 09:16:45.111 1180-1180/? E/SamsungIME: SwiftKey guide popup condition 2 : false false true true true false true true true true
  09-18 09:16:47.223 755-1027/? E/Watchdog: !@Sync 2101 [09-18 09:16:47.228]
  09-18 09:16:58.164 1180-1180/? E/SamsungIME: ET9KDB_SetKdbNum : 10
  09-18 09:16:58.164 1180-1180/? E/SamsungIME: ET9KDB_GetKdbNum : 39
  09-18 09:16:58.174 1180-1180/? E/SamsungIME: ET9KDB_GetPageNum : 39
  09-18 09:16:58.174 1180-1180/? E/SamsungIME: ET9KDB_SetKdbNum : 10
  09-18 09:16:58.174 1180-1180/? E/SamsungIME: ET9KDB_GetPageNum : 39
  09-18 09:16:58.174 1180-1180/? E/SamsungIME: ET9KDB_SetAmbigMode : 39
  09-18 09:16:58.254 1180-1180/? E/SamsungIME: ET9KDB_GetKdbNum : 39
  09-18 09:16:58.254 1180-1180/? E/SamsungIME: ET9KDB_GetPageNum : 39
  09-18 09:17:03.429 30457-30457/com.urbanx.urbaninsure E/ViewRootImpl: sendUserActionEvent() mView == null
  09-18 0
  </code></pre>