Sinch验证电话号码

时间:2018-11-13 17:00:11

标签: java android sinch

Sinch验证错误 我正在使用Sinch服务进行电话号码验证

添加电话号码并单击下一步后,应用程序崩溃

这是登录代码

LoginActivity.java:320

 private void startVerification(String phoneNumber) {

        Config config = SinchVerification.config().applicationKey("xxx").context(getApplicationContext()).build();
        VerificationListener listener = new MyVerificationListener();
        String defaultRegion = PhoneNumberUtils.getDefaultCountryIso(getApplicationContext());
        String phoneNumberInE164 = PhoneNumberUtils.formatNumberToE164(phoneNumber, defaultRegion);
        verification = SinchVerification.createSmsVerification(config, phoneNumberInE164, listener); // 320
        verification.initiate();
    }

LoginActivity.java:252)

                    strNum = mblNum.getText().toString();
                if (Validations.getInstance().isValidPhone(strNum)) {
                    if(terms_cond_CB.isChecked()){
                        Apis.showCustomProgressDialog(LoginActivity.this,"",false);
                        DataManager.USER_PHONE_NUM = countryCode + strNum;
                        System.out.println("mobilenum==>" + DataManager.USER_PHONE_NUM);
                        // showProgressDialog();
                        startVerification(DataManager.USER_PHONE_NUM);//252
                    }

崩溃代码  ---------崩溃开始

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.guru.sociali, PID: 5550
    java.lang.IllegalStateException: Could not execute method for android:onClick
        at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:389)
        at android.view.View.performClick(View.java:6597)
        at android.view.View.performClickInternal(View.java:6574)
        at android.view.View.access$3100(View.java:778)
        at android.view.View$PerformClick.run(View.java:25885)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:384)
        at android.view.View.performClick(View.java:6597) 
        at android.view.View.performClickInternal(View.java:6574) 
        at android.view.View.access$3100(View.java:778) 
        at android.view.View$PerformClick.run(View.java:25885) 
        at android.os.Handler.handleCallback(Handler.java:873) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6669) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
     Caused by: java.lang.IllegalArgumentException: Number string cannot be null.
        at com.sinch.verification.internal.t.a(Unknown Source:22)
        at com.sinch.verification.internal.t.a(Unknown Source:11)
        at com.sinch.verification.SinchVerification.createVerification(Unknown Source:138)
        at com.sinch.verification.SinchVerification.createSmsVerification(Unknown Source:7)
        at com.sinch.verification.SinchVerification.createSmsVerification(Unknown Source:1)
        at com.socialiapp.LoginActivity.startVerification(LoginActivity.java:320)
        at com.socialiapp.LoginActivity.onClick(LoginActivity.java:252)
        at java.lang.reflect.Method.invoke(Native Method) 
        at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:384) 
        at android.view.View.performClick(View.java:6597) 
        at android.view.View.performClickInternal(View.java:6574) 
        at android.view.View.access$3100(View.java:778) 
        at android.view.View$PerformClick.run(View.java:25885) 
        at android.os.Handler.handleCallback(Handler.java:873) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6669) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

任何人都知道问题是什么

谢谢

0 个答案:

没有答案