📄 sendserviceindication.java~1~
字号:
import java.io.File;import java.io.IOException;import java.util.Date;import com.objectxp.msg.GsmSmsService;import com.objectxp.msg.MessageException;import com.objectxp.msg.SmsService;import com.objectxp.msg.ota.ServiceIndication;/** * The SI provides a way to inform a user that an event has occurred and indicate * a URL that can be loaded in order to react to that event. * This is done by sending a SMS to the client that informs the recipient about * the event, and a URL from where the appropriate service can be loaded. * For example, the message could state that "A new mail has arrived", including * the URL of the Web-Email interface. * */public class SendServiceIndication { public static void main(String[] args) throws IOException, MessageException { System.out.println("file: "+new File("x").getAbsolutePath()); if(args.length != 2 ) { System.err.println("Usage: SendSMS <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 ServiceIndication ServiceIndication indication = new ServiceIndication("http://www.objectxp.com", "good morning"); indication.setRecipient(args[1]); indication.setCreated(new Date()); System.out.println(indication); // connect, send message and disconnect try { service.connect(); service.sendMessage(indication); service.disconnect(); } finally { service.destroy(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -