2

I want to get the text and sender of the SMS read from the modem so that I can manipulate it as appropriate and then delete the read and used messages.this is the part of the code:

msgList = new ArrayList<InboundMessage>();
Service.getInstance().readMessages(msgList, MessageClasses.ALL);
for (InboundMessage msg : msgList)
   System.out.println(msg);
   System.out.println("Now Sleeping - Hit <enter> to stop service.");
   System.in.read();
   System.in.read();
}
zoomrock
  • 61
  • 5

3 Answers3

0

the answers is :

text = msg.getText().toString();
sender = msg.getOriginator().toString();
bentham
  • 1,701
  • 3
  • 20
  • 32
0

Answer

String message = msg.getText(); String sender = msg.getOriginator();

jitesh
  • 14
0

It is easy ..Edit the code as follows :

to get the text SMS:

System.out.println(msg.getText());

to get the sender of the SMS:

System.out.println(msg.getOriginator());

It is all ..