A simple text message sender using Android (not including Group Sending, of course)

Source: Internet
Author: User

I used a simple Phone Dialer before, so it was easy to get started when I was sending text messages. In fact, their principle is basically the same. I only implement one-to-one SMS sending. Of course, if you want to send a group message, you can also store all the phone numbers in an array, then you can traverse them one by one. One-to-one messages will be sent and sent in a group. Through this smallProgramI will make the following summary:

(1)

Like the Phone Dialer program, Android actually provides us with a manager internally, as long as we use some of its methods.

(2)

It also involves a permission issue. Unlike the phone dial, it uses a permission to send text messages,CodeAs follows:

<Uses-Permission Android: Name = "android. Permission. send_sms"> </uses-Permission>

You only need to add it to the manifest file. In fact, what I want to say here is that, in fact, there are many things, many knowledge points, many methods, and the meaning of each parameter, which have been defined and written in the SDK documentation, we only need to read it. Now, I feel that the document is really a good thing. We can never understand every method, nor do we need to understand it. To be precise, we simply cannot understand it. When we use it and do not know what it means, we can query its documents, which is also good for improving our English.

(3)

In the text message sender, if you want to send a short message after sending it, and then it disappears naturally, you can try to write the following code:

Toast. maketext (smsactivity. This, "sent successfully", Toast. length_short). Show ();

Of course, the above is just an example. You can change the parameter content as needed. There are two methods for this toast (toast) class. I just used one of them, and the other method is similar, but there is a different parameter. To put it bluntly, the next method is to better support internationalization. As for what specific parameters mean, we can refer to its documentation to see what they mean, which is easy to understand. Remember to write. Show (), or it will not be displayed.

The above is my summary after writing this small program. I hope to share with you!

Related Article

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.