Use the SDK here (
The SDK is the abbreviation for the Software Development Kit, which means "software development kit" in Chinese. This is a fairly broad term, so to speak: the collection of related documents, examples, and tools that assist in the development of a particular type of software can be called the SDK. specifically to our tutorial series, we will discuss only a subset of the generalized SDK-the SDK used to develop applications under the Windows platform. It's just a short little idea.) To send SMS verification codes or SMS notifications to your phone. We use "Ali greater than" Download SDK here, Ali greater than the official link
https://dayu.aliyun.com/?utm_content=se_1056231
Go to the page to register
Follow the prompts to register and then click on the console
Click SMS Business to find
After clicking Java Read, follow the prompts to create (AK) AccessKey (copy desktop, very important), SMS signature, SMS template. SMS signature and text message templates to be approved before they can be used, the audit standards are below. Note (only one signature can have a single sign, and a number of templates may be available) after all three applications are completed, find the SDK download on this page.
After the download, unzip the SDK and demo after the extract is finished.
(1): Follow the directory to find Smsdemo.java
E:\SDK\java\api_demo\alicom-dysms-api\src\main\java\com\alicom\dysms\api
Note (The storage disk may be different, mine is extracted under the E:\sdk folder)
(2): You can also import the project directly
I use the first method
After locating Smsdmeo, create a copy of the Java project and copy the dependent two jar packages over and BuildPath
Open your Smsdemo.
The comments are comprehensive (note that the AK in the Smsdemo is replaced by the following position)
These two positions are Ali greater than the one in this position, copied over.
Read the comment after copying it well.
Below also need to change the location
Note the location of the ${code}, if your template verification code type, the front of the ${name} can be removed to appear, otherwise the return value will be null;
Note here that your Ali is more than the balance recharge a few yuan, otherwise it is not available.
After all the changes have been completed, here is my run result
How does it feel particularly simple to read comments or APIs is to remember not to hurry and read slowly.
Well, I hope to be helpful to beginners who are willing to learn Java;
How to get verification code in the Java language by SMS