Finally, I created a String array in all versions of contacts that I have, since this is the same, it means that the contact table has not been changed, I have not found another way, this is my code
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(); }
source share