I am using following code to send sms from dongle. Its sending Sucessfullly. Now I want to read SIM sms or unread sms from dongle so plaese can any one tell me how to read that
following is the code to send sms
import org.smslib.OutboundMessage;
import org.smslib.Service;
import org.smslib.modem.SerialModemGateway;
...
private String port = "COM4"; // Modem Port.
private int bitRate = 9600; // This is also optional. Leave as it is.
private String modemName = "ZTE"; // This is optional.
private String modemPin = "0000"; // Pin code if any have assigned to the modem.
private String SMSC = "+919822078000"; // Message Center Number ex. Mobitel
...
SerialModemGateway gateway = new SerialModemGateway("", port, 9600, "InterCEL", "");
Service.getInstance().addGateway(gateway);
Service.getInstance().startService();
// System.out.println("center number=" + gateway.getSmscNumber());
gateway.setSmscNumber(SMSC);
gateway.setOutbound(true);
OutboundMessage o = new OutboundMessage(number, str);
gateway.sendMessage(o);
There is InboundMessage class which takes three parameters sunch as gateway, MemoryIndexNumber, SimMemoryLocation which I am unable to get so it returns null
InboundMessage n=new InboundMessage()
gateway.readMessage(n);
If there is any other way to read sms from SIM of dongle.
To read the messages currently in the SIM memory, you can just do
But to do live detection of incoming messages, you need to implement org.smslib.IInboundMessageNotification
E.g.
Then run these before the line which starts the service with .startService()
You can read more in the documentation on github https://github.com/smslib/smslib-v3/tree/master/doc