android - 如何获取联系人列表的最后修改日期(添加/删除/修改)

标签 android contacts

我如何知道联系人表的最后修改日期?我已经尝试过 ContactsContract.RawContacts.VERSIONCONTACT_STATUS_TIMESTAMP 但似乎这些用于了解单个联系人的修改日期,并且它对我来说效果不佳。如何获取联系人列表中任何联系人的最后修改日期

最佳答案

最后我在我拥有的所有联系人版本中创建了一个数组字符串,因为它是相同的,这意味着联系人表没有被更改,我还没有找到任何其他方式,这是我的代码

private String sGetCurrentContatcsVersions() {

        Cursor allContacts = mContext.getContentResolver().query(
                ContactsContract.RawContacts.CONTENT_URI, null, null, null, null);

        StringBuilder sbCurrentVersion = new StringBuilder();
        allContacts.moveToFirst();

        for (int i = 0; i < allContacts.getCount(); i++) {

            if (!TimelineService.bScannerIsRunning) {
                break;
            }
            int col = allContacts.getColumnIndex(ContactsContract.RawContacts.VERSION);
            sbCurrentVersion.append(allContacts.getString(col));
            allContacts.moveToNext();
        }

        return sbCurrentVersion.toString();
    }

关于android - 如何获取联系人列表的最后修改日期(添加/删除/修改),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10702547/

相关文章:

Android短信内容(内容://sms/sent)

android - 联系人 ContentObserver 随机调用

android - ActivityCompat 和 ContextCompat 有什么区别?

java - 使用复选框显示所有电话联系人

android - 在 Android 中创建 Connect4

android.database.CursorIndexOutOfBoundsException : Index -1 requested, 大小为 2

用于身份验证和导入联系人的 Java 库

android - 布局位于库模块中时合成 View 的未解决引用

android - GooglePlayServicesUtil 与 GoogleApiAvailability

android - 如何在 ListView 中显示电话联系人