public class InboundNotification implements IInboundMessageNotification {
public void process(AGateway gateway, MessageTypes msgType, InboundMessage msg) {
if (msgType == MessageTypes.INBOUND)
System.out.println(">>> New Inbound message detected from Gateway: " + gateway.getGatewayId());
else if (msgType == MessageTypes.STATUSREPORT)
System.out.println(">>> New Inbound Status Report message detected from Gateway: " + gateway.getGatewayId());
System.out.println(msg);
String mobile=msg.getOriginator();
String content=msg.getText();
HttpClient client = new HttpClient();
GetMethod method = new GetMethod("http://192.168.1.200/sdkdemo/getNumber.jsp?mobile="+mobile+"&content="+content);
try {
client.executeMethod(method);
} catch (HttpException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
method.releaseConnection();
}
}
}
这是源代码,我想要实现的是一有短信进来就读取最新的一条短信 获取手机号码和短信内容,但是实际读取出来的总是所有的短信都读出来了,请问这个如何解决?