2015-04-01 60 views
0

我想從短信列表中檢測到哪些消息屬於我的,並且它們屬於其他聯繫人。Android detect短信屬於發件人或收件人

例如:

我: 「身體」:你好約翰

約翰「身上:您好...

Uri uriSMSURI = Uri.parse("content://sms/"); 
      Cursor cur = getActivity().getContentResolver().query(uriSMSURI, null, null, null, null); 
      while (cur.moveToNext()) { 
       //detect here 
} 

回答

0

可以使用Telephony.TextBasedSmsColumns.CREATOR領域獲得的創造者。將此與您的地址(手機號碼)進行比較,以區別於其他人。您可以通過以下方式獲取號碼:

(TelephonyManager)getSystemService(TELEPHONY_SERVICE).getLine1Number(); 
相關問題