forevereli 2016-09-29 06:00 采纳率: 0%
浏览 1030

java短信猫开发smslib读取短信总是读取所有的短信怎么办?

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

    }
}

这是源代码,我想要实现的是一有短信进来就读取最新的一条短信 获取手机号码和短信内容,但是实际读取出来的总是所有的短信都读出来了,请问这个如何解决?

  • 写回答

2条回答 默认 最新

  • dabocaiqq 2016-10-03 15:56
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?