⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendemstext.java~1~

📁 控制手机发送短信程序
💻 JAVA~1~
字号:
import java.io.File;import java.io.IOException;import com.objectxp.msg.GsmSmsService;import com.objectxp.msg.MessageException;import com.objectxp.msg.SmsService;import com.objectxp.msg.ems.EMSMessage;import com.objectxp.msg.ems.EMSText;/** * This example demonstrates how to send a long text as EMSMessage using jSMS. * The text will be splited and transmited in several parts to consider the * 160 digits limitation of a sms message.  */public class SendEMSText {  private static final String LONG_TEXT =     "Enhanced Messaging Service (EMS) adds new powerful functionality to the"+    " well-known SMS standard. With it, mobile phone users can add life to SMS"+    " text messaging in the form of pictures, animations, sound and formatted"+    " text. This gives the users new ways to express feelings, moods and"+    " personality in SMS messages. As well as messaging, users will enjoy"+    " collecting and swapping pictures and ring signals and other melodies,"+    " downloading them from the Internet or editing them directly on the"+    " phone.";    public static void main(String args[]) throws IOException, MessageException  {    if(args.length != 2 ) {      System.err.println("Usage: SendEMSText <config-file> <recipient>");      System.exit(1);    }    // Create and initialize the SmsService (Replace GsmSmsService with    // the SmsService Implementation of your choice).    SmsService service = new GsmSmsService();    service.init(new File(args[0]));        // create picture message    EMSMessage ems = new EMSMessage();    // add elements to the message    EMSText emsText = new EMSText(LONG_TEXT);    ems.add(emsText);    // set recipient    ems.setRecipient(args[1]);    // connect, send message and disconnect     try {      service.connect();      service.sendMessage(ems);      service.disconnect();    }    finally {      service.destroy();     }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -