sendsmartvcalendar.java

来自「控制手机发送短信程序」· Java 代码 · 共 47 行

JAVA
47
字号
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.smart.VCalendar;

/**
 * This example demonstrates how to send Calendar Entries using jSMS.
 */
public class SendSmartVCalendar
{
  public static void main(String args[]) throws IOException, MessageException
  {
    if(args.length != 2 ) {
      System.err.println("Usage: SendSmartVCalendar <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]));

    VCalendar vc = new VCalendar();
    vc.setRecipient(args[1]);

    vc.setSummary("Business Lunch");
    vc.setDescription("meet your clients");
    vc.setStart("20030815","123000");
    vc.setEnd("20030815","140000");

    // connect, send message and disconnect
    try {
      service.connect();
      service.sendMessage(vc);
      service.disconnect();
    }
    finally {
      service.destroy();
    }
  }
}

⌨️ 快捷键说明

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