I have been searching about this problem; I read about rxtx, javacom, smslib etc. I have found several article but I can't really understand it because I'm a beginner.
Actually I found some good article that can send SMS here here but the problem is I want to read incoming sms then delete it after that.
I have found that I can do that by using AT+CMGR, AT+CMGL from here
What syntax in Java do I need to try the AT+CMGR and AT+CMGL to read the sms and at least print it?
I already succeed to check which port is ready by using this code:
package anothersms;
import gnu.io.*;
import java.util.Enumeration;
public class CommPortTest {
public static void main(String[] args) {
System.out.println("Program Started!!!");
CommPortIdentifier serialPortId;
Enumeration enumComm;
enumComm = CommPortIdentifier.getPortIdentifiers();
while(enumComm.hasMoreElements())
{
serialPortId = (CommPortIdentifier)enumComm.nextElement();
if(serialPortId.getPortType() == CommPortIdentifier.PORT_SERIAL)
{
System.out.println(serialPortId.getName());
}
}
System.out.println("Program Finished Sucessfully");
}
}
After long way to setting DLL etc I find that works, but still I barely understand it.
I get it the code to read and delete the message. But it doesn't use at command, its using
smslib, but still its simple enough so i don't really confused.i get the code from here, the code even giving us ability to listen if there is incoming message and notify us.
Furthermore i add some code to delete incoming message after read it. Here is the code