3

I have build an application to sending short messages using smpp 3.4 and that work well, but in some phones i got this message:

Can not display this message

this is my function source code :

public String sendMsg(JsonObject paramsIN) {
    String smsMessage = paramsIN.getString("body");
    String smsDestination = paramsIN.getString("to");
    String smsSource = paramsIN.getString("from");
    String smscNAME = paramsIN.getString("smsc");

    SubmitSM request = new SubmitSM();
    SubmitSMResp response;
    Session session;
    try {
        request.setSourceAddr(smsSource);
        request.setDestAddr(smsDestination);
        request.setShortMessage(smsMessage, "UTF-8");
        request.setRegisteredDelivery((byte) 3);
        request.setDataCoding((byte) 4); // 4
        request.assignSequenceNumber(true);
        response = ((Session) sd.get(smscNAME)).submit(request);
        logger.info("Submit response " + response.debugString());
        String messageId = response.getMessageId();       

        BigInteger bigInt = new BigInteger(messageId, 16);  

        return bigInt+"";
    } catch (WrongLengthOfStringException e) {
        logger.error(e);
        return null;
    } catch (PDUException e) {
        logger.error(e);
        return null;
    } catch (TimeoutException e) {
        logger.error(e);
        return null;
    } catch (WrongSessionStateException e) {
        logger.error(e);
        return null;
    } catch (IOException e) {
        logger.error(e);
        return null;
    }
}

please someone can help me, thanks

Mhammad Sellam
  • 160
  • 1
  • 15

1 Answers1

1

Set data coding to 0 (network default) and encode the body with whatever charset your provider supports. Use the GSM default charset if you have to guess (jcharset includes an encoder). If you really need an extended charset use UTF-16BE and set data coding to 8.

teppic
  • 7,051
  • 1
  • 29
  • 35
  • thanks that's works (y). i add this in my code `request.setShortMessage(smsMessage, Data.ENC_UTF16_BE); request.setDataCoding((byte)0x08);` – Mhammad Sellam Dec 02 '16 at 10:50
  • Hi teppic thanks for your solution, but i have an other problem that in some other smart phone like "samsung galaxy g1 ace" i have this message "Content not supported" – Mhammad Sellam Dec 15 '16 at 09:34