有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Android设备无法接收来自SMPPGW的消息

我已经实现了使用Cloud Hopper发送短信的功能

public static SubmitSmResp sendShortMessage(String sourceAddress, byte[] textBytes, String destinationAddress) {
    SubmitSmResp submitResponse = null;
    try {

        // set encoding for sending SMS
        submit.setDataCoding(SmppConstants.DATA_CODING_JIS);

        submit.setShortMessage(textBytes);
        submit.setSourceAddress(new Address((byte) 0x05, (byte) 0x01, sourceAddress));
        submit.setDestAddress(new Address((byte) 0x01, (byte) 0x01, destinationAddress));

        // submit message to SMSC for delivery with a timeout of 10000ms
        submitResponse = session.submit(submit, 10000);
        if (submitResponse.getCommandStatus() == SmppConstants.STATUS_OK) {
            System.out.println("SMS submitted, message id {}" + submitResponse.getMessageId());
        } else {
            throw new IllegalStateException(submitResponse.getResultMessage());
        }
    } catch (RecoverablePduException | UnrecoverablePduException | SmppTimeoutException |
            SmppChannelException | InterruptedException e) {
        throw new IllegalStateException(e);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return submitResponse;
}

但当我将sim卡插入ios设备时,我可以接收来自smppgw的消息。然后我将sim卡插入安卓设备,即submitResponse。getCommandStatus()==SmppConstants。状态_OK为真,但我无法收到短信。最后,我将sim卡插回ios设备,这是我从安卓设备发送信息时收到的信息。有人知道如何解决这个问题吗


共 (1) 个答案

  1. # 1 楼答案

    这听起来不像是SMPP客户端的问题。我的意思是,只要您在发送submit_sm时收到状态为OK的submit_sm_resp,就意味着SMSC/SMPPGW接受了该消息。 听起来更像是SMSC问题或终端问题,因为问题在于从SMSC到终端的交付

    一个简单的解释可能是,Android终端存在一些问题/信号缺失/未注册到网络,这就是SMSC不发送短信的原因。一旦你更换了终端,sim卡就会在线,SMSC就会发送上一条短信