sendotabookmark.java
来自「控制手机发送短信程序」· Java 代码 · 共 42 行
JAVA
42 行
package sms;
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.ota.Bookmark;
/**
* This example demonstrates how to send a OTA Bookmark.
*/
public class SendOtaBookmark
{
public static void main(String[] args) throws IOException, MessageException
{
if(args.length != 4 ) {
System.err.println("Usage: SendSMS <config-file> <recipient> <bookmark name> <url>");
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 message
Bookmark msg = new Bookmark(args[2], args[3]);
msg.setRecipient(args[1]);
// connect, send message and disconnect
try {
service.connect();
service.sendMessage(msg);
service.disconnect();
} finally {
service.destroy();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?