簡體   English   中英

對於Android,是否有辦法確定已向聯系人發送多少條短信?

[英]For Android, is there a way to determine how many text messages have been sent to a contact?

我正在從ContractContacts中讀取聯系人數據,並且可以查找TIMES_CONTACTED(對我有用),但是此字段僅適用於對該聯系人的呼叫。 我也對通過SMS或電子郵件聯系聯系人的次數感興趣。

有人知道此信息是否可用嗎? 我一直在搜索,但沒有遇到任何問題。

對於SMS,您將要直接訪問位於content:// sms / inbox的收件箱,並執行數據庫查詢以計算與匹配聯系人相對應的行數。

就像是:

String personAddress = addressFromContact();
Uri smsUri = new Uri("content://sms");
if (smsUri != null) {
  Cursor smsCursor = getContentResolver().query(smsUri, null, "address=?", new String[] {personAddress}, null);
  int smsCount = smsCursor.getCount();
  }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM