I use the following code to send sms from a key. Its dispatch is sucessfullly. Now I want to read SIM sms or unread sms from the key, so plaese can someone tell me how to read that
Below is the code for sending 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 an InboundMessage class that takes three sunch parameters like gateway, MemoryIndexNumber, SimMemoryLocation, which I cannot get to return null
InboundMessage n=new InboundMessage() gateway.readMessage(n);
If there is another way to read SMS from a SIM card key.
java smslib
pareshm
source share