Frage

I'm using SMSLib to read messages from a specified gateway, the piece of code used for reading the messages is :

List<InboundMessage> msgList = new ArrayList<InboundMessage>();

        Service.getInstance().readMessages(msgList, MessageClasses.ALL);
        for (InboundMessage msg : msgList)
            System.out.println(msg);    

The point here that i want to get the phone number that send this message to the gateway, is that possible? and it yes, how?

War es hilfreich?

Lösung

Use msg.getOriginator();

Note that the SMS protocol does not require the phone number of the sender to be present,(and it might even be text, and not a phone number).

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top