ContentResolver contentResolver = getContentResolver();
Handler handler = new Handler();
m_SMSObserver = new SMSObserver(handler);
contentResolver.registerContentObserver(Uri.parse("content://sms"),
true, m_SMSObserver);
这段代码用于分离发送/接收事件
Uri uriSMSURI = Uri.parse("content://sms");
Cursor cur = this.getContentResolver().query(uriSMSURI, null, null,
null, null);
cur.moveToNext();
String protocol = cur.getString(cur.getColumnIndex("protocol"));
if(protocol == null)
onSMSSend();
else
onSMSReceive();
检查以下网址以供参考:
http://www.mail-archive.com/android-developers@googlegroups.com/msg27154.html