To call Bmob third-party server to implement SMS verification, the general idea is as follows:
Randomly generate 6-digit numbers, then call Bmob's request short-send function and send the sender to the server with a six-digit number. The server then sends these 6-digit verification codes to the designated mobile phone, and then feels that the number entered by the user makes a judgment. If the input and sent are equal, the verification is successful.
Step 1: Request verification code:
SimpleDateFormat format =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String sendTime = (new Date()); // Generate 6-digit verification codeint round = (int) (() * (999999 - 100000) + 100000); verifycode = (round); (this, number, "Your verification code is"+ verifycode +", please verify it in time!",sendTime,new RequestSMSCodeListener() { @Override public void done(Integer smsId,BmobException ex) { if(ex==null){//The verification code is successfully sent(,"Verification code sent successfully:",Toast.LENGTH_SHORT).show(); }else{ (,"Send failed:errorCode = "+()+",errorMsg = "+(),Toast.LENGTH_SHORT).show(); } } });
Step 2: Verify the verification code:
The user input and the system randomly generated by the system are judged. If the same is true, the verification will be successful.
The above is what the editor introduced to you. Android uses a third-party server Bmob to send SMS verification code. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support for my website!