Hi,
Is it possible to get the phone number of a received sms within code?
Look at this example at the if-statement:
@Override
public void onReceive(Context context, Intent intent) {
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]);
}
if([HOW DO I GET THE NUMBER]) {
Toast toast = Toast.makeText(context, "New SMS: " + smsMessage
[0].getMessageBody(), Toast.LENGTH_LONG);
toast.show();
}
}
Thank you very much!
Best regards
Kaloer
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---