In a program, there are generally three ways to send short messages:
1, the use of the program on the network to send short messages, such as the major web site SMS business. This approach is to send the information to the operator's gateway server via the program and send it to the phone via the operator's network.
2, in the computer, through the data line to connect to the phone, and then through the mobile phone to send short messages. This is done by using the AT command. Ericsson Mobile at command you can find at the following address: http://mobilityworld.ericsson.com.cn/development/download_hit.asp
3, through the mobile phone to run the program to send short messages. This is the way this article is implemented.
In J2ME, if you want to send short messages, you need to use WMA packs, which are already included in MIDP2.0, MIDP1.0
Can be implemented through vendor-supplied extension APIs, as is the case with WMA's class library.
The following is a simple way to send short messages using WMA to a given cell phone number. Of course WMA also provides other ways to send more content.
Smsutil.java
Package my.util;
Import javax.wireless.messaging.*;
Import javax.microedition.io.*;
/**
* Ways to send text messages
*/
public class smsutil{
/**
* Send SMS to specified number
* @param content text messages
* @param phonenumber Mobile phone number
* Returns True @return sent successfully, otherwise returns false
*/
public static Boolean send (String content,string phonenumber) {
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.