user1967089
user1967089

Reputation: 11

Send SMS through USB gsm modem with Java

What is the best way? I have read about it but most topics are obsolete. Most examples are using "COM" port, but I cannot find my USB modem in COM connections (in device manager), instead of that it is in "network cards".

Upvotes: 0

Views: 7365

Answers (1)

Glory
Glory

Reputation: 1077

Hope this code helps:

 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) 
    } 
}

The complete answer and details are at this article

Upvotes: 1

Related Questions