How to read the hex sms message in onReceive()

Put your problem here if it does not fit any of the other categories.

How to read the hex sms message in onReceive()

Postby surya.n.k » Fri Mar 19, 2010 7:21 am

hi all,

how can i read the hex sms message in onReceive() method.

Bundle bundle = intent.getExtras();
Object messages[] = (Object[]) bundle.get("pdus");
SmsMessage smsMessage[] = new SmsMessage[messages.length];
for (int n = 0; n < messages.length; n++) {
smsMessage[n] = SmsMessage.createFromPdu((byte[]) messages[n]);
}
// show first message
Toast.makeText(context, "Received SMS: " + smsMessage[0].getMessageBody(), Toast.LENGTH_LONG).show();

i am getting null in the toast.
surya.n.k
Developer
Developer
 
Posts: 26
Joined: Fri Dec 07, 2007 7:33 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 14 guests