I have a broadcast receiver SMSApp which onReceive reads bundleExtras from intent. Here, How can I read phone number from bundleExtras?
if(intent.getAction().equals(SMS_RECEIVED))
{
Bundle bundleExtras = intent.getExtras();
if (bundleExtras != null)
{
}
}
Tutorial at http://ukitech.blogspot.com/2014/11/android-sms-app.html
OUTPUT:
SmsReceiver.processReceivedSms﹕ SMS from +1650815xxxx
SmsReceiver.processReceivedSms﹕ SMS body Test 4
/** * Created by uki on 11/22/14. */
public class SmsReceiver extends BroadcastReceiver {
Now,
messages[0].getOriginatingAddress()
is the address andmessages[0].getMessageBody()
is the message body.This is a link to a detailed "how to send and receive sms messages", you should check it, it is complete and full with examples:
http://mobiforge.com/developing/story/sms-messaging-android
also using this link, you can do: