什么是最好的方法?我已经读过,但是大多数主题都已过时。大多数示例都使用“ COM”端口,但是我无法在COM连接(在设备管理器中)中找到我的USB调制解调器,而是在“网卡”中找到了。
最佳答案
希望这段代码对您有所帮助:
package logic;
import com.harshadura.gsm.smsdura.GsmModem;
public class TestSMS {
private static String port = "COM3"; //Modem Port.
private static int bitRate = 115200; //this is also optional. leave as it is.
private static String modemName = "ZTE"; //this is optional.
private static String modemPin = "0000"; //Pin code if any have assigned to the modem.
private static String SMSC = "+9477000003"; //Message Center Number ex. Mobitel
public static void main(String[] args) throws Exception {
GsmModem gsmModem = new GsmModem();
GsmModem.configModem(port, bitRate, modemName, modemPin, SMSC);
gsmModem.Sender("+94712244555", "Test Message"); // (tp, msg)
}
}
完整答案和详细信息为at this article