How to get verification code in the Java language by SMS

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.